├── .gitignore ├── AUTHORS ├── CMakeLists.txt ├── COPYING.BSD ├── COPYING.GPL ├── COPYING.LGPL ├── Jenkinsfile ├── README-Autopilot.md ├── README-ContentHubDesktop.md ├── README-Developers.md ├── README-NewBuildInstructions.md ├── README-PullRequests.md ├── README-Translations.md ├── README.md ├── clickable.json ├── com.ubuntu.filemanager.desktop.in.in ├── content-hub.json ├── debian ├── changelog ├── compat ├── control ├── copyright ├── qtdeclarative5-archives0.1.install ├── qtdeclarative5-nemo-qml-plugin-folderlistmodel.install ├── qtdeclarative5-placesmodel0.1.install ├── rules ├── source │ └── format ├── ubuntu-filemanager-app-autopilot.install └── ubuntu-filemanager-app.install ├── filemanager.apparmor ├── filemanager.svg ├── manifest.json.in ├── po ├── CMakeLists.txt ├── am.po ├── ar.po ├── ast.po ├── be.po ├── bg.po ├── br.po ├── bs.po ├── ca.po ├── ckb.po ├── com.ubuntu.filemanager.pot ├── cs.po ├── da.po ├── de.po ├── el.po ├── en_AU.po ├── en_GB.po ├── en_US.po ├── eo.po ├── es.po ├── eu.po ├── fa.po ├── fi.po ├── fr.po ├── fr_CA.po ├── gd.po ├── gl.po ├── he.po ├── hu.po ├── id.po ├── it.po ├── ja.po ├── km.po ├── kn.po ├── ku.po ├── lo.po ├── lt.po ├── lv.po ├── ml.po ├── ms.po ├── my.po ├── nb.po ├── nl.po ├── pa.po ├── pl.po ├── po.pro ├── pt.po ├── pt_BR.po ├── ro.po ├── ru.po ├── sa.po ├── sc.po ├── shn.po ├── sk.po ├── sl.po ├── sq.po ├── sr.po ├── sv.po ├── ta.po ├── tr.po ├── ug.po ├── uk.po ├── uz.po ├── zh_CN.po ├── zh_HK.po └── zh_TW.po ├── setup └── gui │ ├── icon.png │ └── ubuntu-filemanager-app.desktop ├── snap └── ubuntu-filemanager-app.wrapper ├── snapcraft.yaml ├── src ├── CMakeLists.txt ├── app │ ├── CMakeLists.txt │ ├── fmutils.cpp │ ├── fmutils.h │ ├── main.cpp │ ├── patharrowbackground.cpp │ ├── patharrowbackground.h │ └── qml │ │ ├── actions │ │ ├── AddBookmark.qml │ │ ├── ArchiveExtract.qml │ │ ├── Delete.qml │ │ ├── FileClearSelection.qml │ │ ├── FileCopy.qml │ │ ├── FileCut.qml │ │ ├── FilePaste.qml │ │ ├── GoBack.qml │ │ ├── GoNext.qml │ │ ├── GoTo.qml │ │ ├── NewItem.qml │ │ ├── PlacesBookmarks.qml │ │ ├── Properties.qml │ │ ├── Rename.qml │ │ ├── Search.qml │ │ ├── Select.qml │ │ ├── SelectUnselectAll.qml │ │ ├── Settings.qml │ │ ├── Share.qml │ │ ├── ShowPanel.qml │ │ ├── TabsAdd.qml │ │ ├── TabsCloseThis.qml │ │ ├── TabsOpenInNewTab.qml │ │ └── UnlockFullAccess.qml │ │ ├── authentication │ │ ├── AuthenticationHandler.qml │ │ ├── FingerprintDialog.qml │ │ ├── PasswordDialog.qml │ │ └── assets │ │ │ └── fingerprint.png │ │ ├── backend │ │ ├── FolderListModel.qml │ │ └── GlobalSettings.qml │ │ ├── components │ │ ├── BottomPanelStack.qml │ │ ├── EmptyState.qml │ │ ├── HorizontalOptionSelector.qml │ │ ├── PathHistoryRow.qml │ │ ├── ResizeableSidebar.qml │ │ ├── SectionDivider.qml │ │ ├── SidebarPageLayout.qml │ │ ├── TextualButtonStyle.qml │ │ └── VerticalDivider.qml │ │ ├── content-hub │ │ ├── FileOpener.qml │ │ └── contenttyperesolver.js │ │ ├── dialogs │ │ ├── ConfirmExtractDialog.qml │ │ ├── ConfirmMultipleDeleteDialog.qml │ │ ├── ConfirmRenameDialog.qml │ │ ├── ConfirmSingleDeleteDialog.qml │ │ ├── CreateItemDialog.qml │ │ ├── ExtractingDialog.qml │ │ ├── FileActionDialog.qml │ │ ├── FileOperationProgressDialog.qml │ │ ├── NetAuthenticationDialog.qml │ │ ├── NotifyDialog.qml │ │ ├── OpenArchiveDialog.qml │ │ ├── OpenWithDialog.qml │ │ └── templates │ │ │ ├── ConfirmDialog.qml │ │ │ └── ConfirmDialogWithInput.qml │ │ ├── filemanager.qml │ │ ├── panels │ │ ├── DefaultBottomBar.qml │ │ ├── SelectionBottomBar.qml │ │ └── template │ │ │ └── Panel.qml │ │ ├── ui │ │ ├── FileDetailsPopover.qml │ │ ├── FolderListPage.qml │ │ ├── FolderListPageDefaultHeader.qml │ │ ├── FolderListPagePickModeHeader.qml │ │ ├── FolderListPageSelectionHeader.qml │ │ ├── ImagePreview.qml │ │ ├── PlacesPage.qml │ │ └── ViewPopover.qml │ │ └── views │ │ ├── FolderDelegateActions.qml │ │ ├── FolderIconDelegate.qml │ │ ├── FolderIconView.qml │ │ ├── FolderListDelegate.qml │ │ └── FolderListView.qml └── plugin │ ├── CMakeLists.txt │ ├── archives │ ├── CMakeLists.txt │ ├── archives.cpp │ ├── archives.h │ ├── archives_plugin.cpp │ ├── archives_plugin.h │ └── qmldir │ ├── folderlistmodel │ ├── CMakeLists.txt │ ├── README │ ├── cleanurl.cpp │ ├── cleanurl.h │ ├── clipboard.cpp │ ├── clipboard.h │ ├── diritemabstractlistmodel.h │ ├── diriteminfo.cpp │ ├── diriteminfo.h │ ├── dirmodel.cpp │ ├── dirmodel.h │ ├── dirselection.cpp │ ├── dirselection.h │ ├── disk │ │ ├── disklocation.cpp │ │ ├── disklocation.h │ │ ├── disklocationitemdir.cpp │ │ ├── disklocationitemdir.h │ │ ├── disklocationitemdiriterator.cpp │ │ ├── disklocationitemdiriterator.h │ │ ├── disklocationitemfile.cpp │ │ └── disklocationitemfile.h │ ├── externalfswatcher.cpp │ ├── externalfswatcher.h │ ├── filecompare.cpp │ ├── filecompare.h │ ├── filesystemaction.cpp │ ├── filesystemaction.h │ ├── fmutil.cpp │ ├── fmutil.h │ ├── folderlistmodel.pri │ ├── folderlistmodel.pro │ ├── imageprovider.cpp │ ├── imageprovider.h │ ├── iorequest.cpp │ ├── iorequest.h │ ├── iorequestworker.cpp │ ├── iorequestworker.h │ ├── ioworkerthread.cpp │ ├── ioworkerthread.h │ ├── location.cpp │ ├── location.h │ ├── locationitemdir.cpp │ ├── locationitemdir.h │ ├── locationitemdiriterator.cpp │ ├── locationitemdiriterator.h │ ├── locationitemfile.cpp │ ├── locationitemfile.h │ ├── locationsfactory.cpp │ ├── locationsfactory.h │ ├── locationurl.cpp │ ├── locationurl.h │ ├── net │ │ ├── netauthenticationdata.cpp │ │ ├── netauthenticationdata.h │ │ ├── netutil.cpp │ │ └── netutil.h │ ├── networklistworker.cpp │ ├── networklistworker.h │ ├── networklocation.cpp │ ├── networklocation.h │ ├── plugin.cpp │ ├── plugin.h │ ├── qmldir │ ├── smb │ │ ├── qsambaclient │ │ │ ├── qsambaclient.pri │ │ │ ├── qsambaclient_test.pro │ │ │ ├── src │ │ │ │ ├── smbiteminfo.cpp │ │ │ │ ├── smbiteminfo.h │ │ │ │ ├── smblocationdiriterator.cpp │ │ │ │ ├── smblocationdiriterator.h │ │ │ │ ├── smblocationitemdir.cpp │ │ │ │ ├── smblocationitemdir.h │ │ │ │ ├── smblocationitemfile.cpp │ │ │ │ ├── smblocationitemfile.h │ │ │ │ ├── smbobject.cpp │ │ │ │ ├── smbobject.h │ │ │ │ ├── smbplaces.cpp │ │ │ │ ├── smbplaces.h │ │ │ │ ├── smbusershare.cpp │ │ │ │ ├── smbusershare.h │ │ │ │ ├── smbutil.cpp │ │ │ │ └── smbutil.h │ │ │ └── test │ │ │ │ ├── main_testqsambaclient.cpp │ │ │ │ ├── testqsambasuite.cpp │ │ │ │ ├── testqsambasuite.h │ │ │ │ └── testsuite.pri │ │ ├── smblocation.cpp │ │ ├── smblocation.h │ │ ├── smblocationauthentication.cpp │ │ └── smblocationauthentication.h │ ├── trash │ │ ├── qtrashdir.cpp │ │ ├── qtrashdir.h │ │ ├── qtrashutilinfo.cpp │ │ ├── qtrashutilinfo.h │ │ ├── trashiteminfo.cpp │ │ ├── trashiteminfo.h │ │ ├── trashlocation.cpp │ │ └── trashlocation.h │ ├── urliteminfo.cpp │ └── urliteminfo.h │ ├── pamauthentication │ ├── CMakeLists.txt │ ├── pamauthentication.cpp │ ├── pamauthentication.h │ ├── pamauthentication_plugin.cpp │ ├── pamauthentication_plugin.h │ └── qmldir │ ├── placesmodel │ ├── CMakeLists.txt │ ├── placesmodel.cpp │ ├── placesmodel.h │ ├── placesmodel_plugin.cpp │ ├── placesmodel_plugin.h │ ├── qmldir │ ├── qmtabparser.cpp │ └── qmtabparser.h │ ├── test_folderlistmodel │ ├── regression │ │ ├── media_asx.h │ │ ├── media_xspf.h │ │ ├── regression_folderlilstmodel.pro │ │ ├── sound_7200_amr.h │ │ ├── sound_mp3.h │ │ ├── tempfiles.cpp │ │ ├── tempfiles.h │ │ ├── testonly_pdf.h │ │ ├── tst_folderlistmodel.cpp │ │ └── ubuntu_touch_run.sh │ ├── results │ │ ├── DesktopQt4.74.txt │ │ ├── DesktopQt5.0.txt │ │ ├── NemoEmulatorQ8.43.txt │ │ └── openFiles.Readme.txt │ └── simpleUI │ │ ├── authenticationdialog.ui │ │ ├── main.cpp │ │ ├── placesmodel.cpp │ │ ├── placesmodel.h │ │ ├── res.qrc │ │ ├── resources │ │ ├── copy.png │ │ ├── cut.png │ │ ├── document_folder.png │ │ ├── downloads_folder.png │ │ ├── edit-rename.png │ │ ├── empty_trash.png │ │ ├── exit.png │ │ ├── fileclose.png │ │ ├── filenew.png │ │ ├── fileopen.png │ │ ├── folder-new.png │ │ ├── go-previous.png │ │ ├── go-up.png │ │ ├── home-page.png │ │ ├── paste.png │ │ ├── recyclebin_full.png │ │ ├── red_folder.png │ │ ├── remove.png │ │ ├── samba_folder.png │ │ ├── server.png │ │ ├── temp_folder.png │ │ ├── trash.png │ │ ├── undo.png │ │ ├── workgroup.png │ │ └── xterm_48x48.xpm │ │ ├── simplelist.cpp │ │ ├── simplelist.h │ │ ├── simplelist.ui │ │ ├── simpleslots.cpp │ │ ├── simpleui.pro │ │ ├── terminalfolderapp.cpp │ │ └── terminalfolderapp.h │ └── test_placesmodel │ ├── placesmodeltest.cpp │ └── test_placesmodel.pro └── tests ├── CMakeLists.txt └── autopilot ├── CMakeLists.txt └── filemanager ├── CMakeLists.txt ├── CMakePluginParser.py ├── __init__.py ├── content ├── Test.tar ├── Test.tar.bz2 ├── Test.tar.gz └── Test.zip ├── fixture_setup.py └── tests ├── CMakeLists.txt ├── __init__.py ├── test_context_menu.py ├── test_filemanager.py └── test_places.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.qmlproject.user 2 | 3 | .build 4 | po/Makefile 5 | debian/files 6 | debian/app-template/ 7 | debian/*.debhelper.log 8 | debian/*.substvars 9 | .excludes 10 | *.user 11 | 12 | # clickable 13 | /build/ 14 | /.clickable/ 15 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | File Manager was started in 2013 and has received many contributions from the following people. 2 | 3 | In addition, numerous translations, bug reports and other non-code contributions have been made which are equally valued. 4 | 5 | Akiva Avraham 6 | Alan Pope 7 | Albert Astals 8 | Arash Badie Modiri 9 | Arto Jalkanen 10 | Barry Warsaw 11 | Bartosz Kosiorek 12 | Benjamin Zeller 13 | Carla Sella 14 | Carlos Mazieri 15 | Chris Gagnon 16 | Daniel Holbach 17 | Daniel Kessel 18 | David Planella 19 | Francis Ginther 20 | imnichol 21 | Jason 22 | Leo Arias 23 | Michael Hall 24 | Michael Spencer 25 | Nicholas Skaggs 26 | Niklas Wenzel 27 | Olivier Tilloy 28 | Omer Akram 29 | Paolo Rotolo 30 | Pawel Stolowski 31 | Richard Somlói 32 | Robert Schroll 33 | Sam Hewitt 34 | Sergio Schvezov 35 | Stefano Verzegnassi 36 | Victor Thompson 37 | -------------------------------------------------------------------------------- /COPYING.BSD: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2012, Robin Burchell 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | The views and conclusions contained in the software and documentation are those 26 | of the authors and should not be interpreted as representing official policies, 27 | either expressed or implied, of the FreeBSD Project. 28 | -------------------------------------------------------------------------------- /README-Autopilot.md: -------------------------------------------------------------------------------- 1 | ReadMe - Run Autopilot tests 2 | ============================ 3 | 4 | # Prerequisites 5 | * ubuntu-ui-toolkit-autopilot : sudo apt-get install ubuntu-ui-toolkit-autopilot 6 | 7 | # Next Steps 8 | Once the app has been built, you can go to the build directory and run: 9 | 10 | cd tests/autopilot 11 | autopilot3 run filemanager 12 | 13 | You can run filemanager in phone or tablet mode passing one of these two switches: 14 | 15 | -p for phone mode 16 | -t for tablet mode 17 | 18 | * autopilot3 launch ../../src/app/filemanager -p will launch filemanager with autopilot in phone mode 19 | * autopilot3 launch ../../src/app/filemanager -t will launch filemanager with autopilot in tablet mode. 20 | -------------------------------------------------------------------------------- /README-ContentHubDesktop.md: -------------------------------------------------------------------------------- 1 | Testing Content-Hub support 2 | =========================== 3 | 4 | ## For the desktop 5 | 6 | Install the following dependencies to run click applications: 7 | 8 | sudo apt-get install upstart-app-launch-tools 9 | 10 | ### Build FileManager and install FileManager as click package 11 | 12 | Build FileManager as a click package and install it. At the time of this writing 13 | this doesn't seem to be working with the SDK (due to cmake), but it can be done 14 | from command line: 15 | 16 | First you must modify manifest.json and replace "architecture" value of "armhf" with "i386". 17 | Just remember to change it back to armhf if you commit changes. 18 | 19 | After that you can build x86 version of the package and install it: 20 | 21 | QT_SELECT=qt5 cmake . -DCLICK_MODE=1 && make -j2 && make install DESTDIR=install && click build install 22 | sudo click install --user=$USER ./com.ubuntu.filemanager_0.3.latest_i386.click 23 | 24 | ### Build and install hub-importer as click package 25 | 26 | Get the sources for building: 27 | 28 | bzr branch lp:~ken-vandine/+junk/hub-importer 29 | 30 | You should be able to create click package out of it in SDK by opening the project and using Publish and Create package. 31 | 32 | Install the created package (example): 33 | 34 | sudo click install --user=$USER com.ubuntu.developer.ken-vandine.hub-importer_0.2_all.click 35 | 36 | ### Running test 37 | 38 | Run hub-importer (example): 39 | 40 | upstart-app-launch com.ubuntu.developer.ken-vandine.hub-importer_hub-importer_0.2 41 | 42 | Click "Select source" button. 43 | 44 | You should see File Manager as one of the choices. If you do not see File Manager, look at "Troubleshooting" section. 45 | Click on File Manager, and File Manager should start. Now you should choose some pictures as that's the only thing 46 | supported at the moment (even though FileManager allows selecting any type). You can select multiple files in a 47 | directory if you so choose. Once you're satisfied with the seelction, click "Select". You should see the pictures 48 | then in Hub Importer. 49 | 50 | Troubleshooting 51 | =============== 52 | 53 | * If you don't see File Manager as one of the choises in Hub Importer, then quit Hub Importer and run this script: 54 | /usr/lib/i386-linux-gnu/content-hub/content-hub-peer-hook 55 | Try running Hub Importer again after that and File Manager should show. 56 | If the above script does not exist, you can try locating something similar with: 57 | locate hook 58 | * If you have trouble running Hub Importer or the above still doesn't work, check the installed click packages with: 59 | click list 60 | It should show entry for both File Manager and Hub Importer. If it does not, installing the click package has not succeeded 61 | * If all else fails, check the logs for both Hub Importer and File Manager for further clues at: 62 | $HOME/.cache/upstart/ 63 | 64 | -------------------------------------------------------------------------------- /README-NewBuildInstructions.md: -------------------------------------------------------------------------------- 1 | Building a click package 2 | ======================== 3 | 4 | ### For a device with xenial 5 | 6 | 1. Be sure you have installed latest [Clickable tool](https://github.com/bhdouglass/clickable) 7 | 8 | 2. Clone the current branch 9 | ``` 10 | git clone https://github.com/ubports/filemanager-app.git [-b *branchname*] 11 | ``` 12 | 13 | 3. Go to the cloned directory 14 | ``` 15 | cd filemanager-app 16 | ``` 17 | 18 | 4. Run clickable 19 | ``` 20 | clickable 21 | ``` 22 | 23 | 5. If you have your device connected via adb, the click packages automatically gets pushed and installed to it. Else you can fork the click packaged from the directory 'build' 24 | -------------------------------------------------------------------------------- /README-PullRequests.md: -------------------------------------------------------------------------------- 1 | Prerequisites to approving a Pull Request (PR) 2 | ============================================== 3 | 4 | Over time, it has been found that insufficient testing by reviewers sometimes leads to file manager app trunk not buildable due to manifest errors, or translation pot file not updated. As such, please follow the checklist below before top-approving a PR. 5 | 6 | Checklist 7 | ========= 8 | 9 | * Does the PR add/remove user visible strings? If Yes, has the pot file been 10 | updated? 11 | 12 | * Does the PR change the UI? If Yes, has it been approved by design? 13 | 14 | * Did you perform an exploratory manual test run of your code change and any 15 | related functionality? 16 | 17 | * If the PR fixes a bug or implements a feature, are there accompanying unit 18 | and autopilot tests? 19 | 20 | * Is the file manager app buildable and runnable using clickable? 21 | 22 | * Was the copyright years updated if necessary? 23 | 24 | The above checklist is more of a guideline to help file manager app stay buildable, 25 | stable and up to date. 26 | -------------------------------------------------------------------------------- /README-Translations.md: -------------------------------------------------------------------------------- 1 | Updating translations 2 | ===================== 3 | 4 | Translations for the Filemanager app happen in [Weblate](https://translate.ubports.com/projects/ubports/filemanager-app/) 5 | and are automatically committed weekly (saturday night) on the master branch in 6 | the po/ folder. 7 | 8 | They are then built and installed as part of the package build. 9 | New translatable messages are being added to the pot file by 10 | CMake (e.g. by running clickable) and added automatically to Weblate. So 11 | developers don't really need to worry about translations. 12 | 13 | However, there is one task that needs to be taken care of: exposing new 14 | translatable messages to translators. Clickable automatically updates the .pot 15 | file. Just don't forget to commit it. 16 | If you are not using clickable, whenever you add new translatable 17 | messages in the code, make sure to follow these steps: 18 | 19 | 1. Run click-buddy retaining the build directory: 20 | `click-buddy --dir . --no-clean` 21 | 2. Commit the generated .pot file: `bzr commit -m"Updated translation template"` 22 | 3. Push the branch and send a pull request as usual 23 | 24 | And that's it, once the branch lands Weblate should take care of all the rest! 25 | 26 | Behind the scenes 27 | ================= 28 | 29 | Behind the scenes, whenever the \*.pot file (also known as translations template) is committed to the master branch Weblate reads it and updates the translatable strings exposed in the web UI. This will enable translators to work on the new strings. 30 | The translations template contains all translatable strings that have been extracted from the source code files. 31 | 32 | Weblate will then commit translations on github weekly (saturday night) 33 | in the form of textual \*.po files to the master branch. The PO files are also usually referred to as the translations files. You'll find a translation file for each language the app has been translated to. 34 | 35 | Translations for core apps follow the standard [gettext format](https://www.gnu.org/software/gettext/). 36 | 37 | * [Weblate](https://translate.ubports.com/projects/ubports/filemanager-app/) 38 | * [Gettext format](https://www.gnu.org/software/gettext/) 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ReadMe - Ubuntu File Manager 2 | ============================ 3 | 4 | Ubuntu File Manager App is the official file manager app for Ubuntu Touch. We follow an open 5 | source model where the code is available to anyone to branch and hack on. The 6 | ubuntu file manager app originally followed a test driven development (TDD) where tests were 7 | written in parallel to feature implementation to help spot regressions easier. 8 | 9 | Building with clickable 10 | ======================= 11 | The easiest way to build this app is using clickable by running the command: 12 | 13 | ``` 14 | clickable 15 | ``` 16 | 17 | See [clickable documentation](http://clickable.bhdouglass.com/en/latest/) for details. 18 | 19 | Building without clickable 20 | ========================== 21 | **DEPENDENCIES ARE NEEDED TO BE INSTALLED TO BUILD AND RUN THE APP**. 22 | 23 | A complete list of dependencies for the project can be found in filemanager-app/debian/control 24 | 25 | The following essential packages are also required to develop this app: 26 | * [ubuntu-sdk](http://developer.ubuntu.com/start) 27 | * intltool - run `sudo apt-get install intltool` 28 | 29 | Useful Links 30 | ============ 31 | Here are some useful links with regards to the File Manager App development. 32 | 33 | * [UBports](https://ubports.com/) 34 | * [clickable](http://clickable.bhdouglass.com/en/latest/) 35 | * [OpenStore](https://open-store.io/app/com.ubuntu.filemanager) 36 | -------------------------------------------------------------------------------- /clickable.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "cmake", 3 | "kill": "terminal-app", 4 | "dependencies": [ 5 | "libtag1-dev", 6 | "libsmbclient-dev", 7 | "libpam0g-dev" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /com.ubuntu.filemanager.desktop.in.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Terminal=false 5 | Exec=@EXEC@ 6 | Icon=@ICON@ 7 | _Name=File Manager 8 | _Keywords=folder;manager;explore;disk;filesystem; 9 | X-Ubuntu-Touch=true 10 | X-Ubuntu-Default-Department-ID=accessories 11 | X-Ubuntu-Splash-Show-Header=true 12 | X-Ubuntu-Splash-Color=#F5F5F5 13 | X-Ubuntu-Single-Instance=true 14 | -------------------------------------------------------------------------------- /content-hub.json: -------------------------------------------------------------------------------- 1 | { 2 | "destination": [ 3 | "all" 4 | ], 5 | "share": [ 6 | "pictures", 7 | "music", 8 | "documents", 9 | "contacts", 10 | "videos", 11 | "ebooks", 12 | "events" 13 | ], 14 | "source": [ 15 | "all" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | ubuntu-filemanager-app (0.5ubports1) xenial; urgency=medium 2 | 3 | * Improved READMEs 4 | 5 | -- Girish Rawat Sat, 19 Dec 2015 13:03:56 +0530 6 | 7 | ubuntu-filemanager-app (0.4) wily; urgency=medium 8 | 9 | * Renamed PAM module to not conflict with the Terminal one. 10 | 11 | -- David Planella Fri, 26 Jun 2015 20:56:51 +0200 12 | 13 | ubuntu-filemanager-app (0.3) trusty; urgency=medium 14 | 15 | * Get the click package to run on devices. (LP: #1294301) 16 | * Get the app to run on the desktop. (LP: #1312712) 17 | 18 | -- David Planella Fri, 25 Apr 2014 14:57:32 +0200 19 | 20 | ubuntu-filemanager-app (0.2) trusty; urgency=medium 21 | 22 | * Merged the plugin code into the main tree, now the main source package 23 | generates a binary package for the app and another for the plugin 24 | 25 | -- David Planella Thu, 10 Apr 2014 09:23:41 +0200 26 | 27 | ubuntu-filemanager-app (0.1.1) raring; urgency=low 28 | 29 | * Initial release 30 | 31 | -- Michael Hall Mon, 11 Feb 2013 16:04:00 -0500 32 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: ubuntu-filemanager-app 3 | Source: https://launchpad.net/ubuntu-filemanager-app 4 | 5 | Files: * 6 | Copyright: 2013 Canonical Ltd. 7 | 2013 Arto Jalkanen 8 | 2013 Daniel Kessel 9 | 2013 Michel Spencer 10 | 2013 Omer Akram 11 | 2013 Paolo Rotolo 12 | 2013 Sam Hewitt 13 | 2013 Victor Thompson 14 | License: GPL-3 15 | 16 | Files: debian/* 17 | Copyright: 2013 Canonical Ltd. 18 | License: LGPL-3 19 | 20 | License: GPL-3 21 | This package is free software; you can redistribute it and/or 22 | modify it under the terms of the GNU General Public 23 | License as published by the Free Software Foundation; either 24 | version 3 of the License. 25 | . 26 | This package is distributed in the hope that it will be useful, 27 | but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | General Public License for more details. 30 | . 31 | You should have received a copy of the GNU General Public License 32 | along with this program. If not, see . 33 | . 34 | On Debian systems, the complete text of the GNU General 35 | Public License can be found in "/usr/share/common-licenses/GPL-3". 36 | 37 | License: LGPL-3 38 | This package is free software; you can redistribute it and/or 39 | modify it under the terms of the GNU Lesser General Public 40 | License as published by the Free Software Foundation; either 41 | version 3 of the License. 42 | . 43 | This package is distributed in the hope that it will be useful, 44 | but WITHOUT ANY WARRANTY; without even the implied warranty of 45 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 46 | Lesser General Public License for more details. 47 | . 48 | You should have received a copy of the GNU General Public License 49 | along with this program. If not, see . 50 | . 51 | On Debian systems, the complete text of the GNU Lesser General 52 | Public License can be found in "/usr/share/common-licenses/LGPL-3". 53 | -------------------------------------------------------------------------------- /debian/qtdeclarative5-archives0.1.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/qt5/qml/com/ubuntu/Archives/ 2 | -------------------------------------------------------------------------------- /debian/qtdeclarative5-nemo-qml-plugin-folderlistmodel.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/qt5/qml/org/nemomobile/folderlistmodel/ 2 | -------------------------------------------------------------------------------- /debian/qtdeclarative5-placesmodel0.1.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/qt5/qml/com/ubuntu/PlacesModel/ 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # Uncomment this to turn on verbose mode. 5 | #export DH_VERBOSE=1 6 | 7 | %: 8 | dh $@ 9 | 10 | override_dh_auto_configure: 11 | dh_auto_configure -- -DCLICK_MODE=OFF 12 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 1.0 2 | -------------------------------------------------------------------------------- /debian/ubuntu-filemanager-app-autopilot.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/dist-packages/filemanager/* 2 | -------------------------------------------------------------------------------- /debian/ubuntu-filemanager-app.install: -------------------------------------------------------------------------------- 1 | usr/bin/* 2 | usr/share/* 3 | -------------------------------------------------------------------------------- /filemanager.apparmor: -------------------------------------------------------------------------------- 1 | { 2 | "policy_version": 16.04, 3 | "template": "unconfined", 4 | "policy_groups": [] 5 | } 6 | -------------------------------------------------------------------------------- /filemanager.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /manifest.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "description": "File Manager application", 3 | "framework": "ubuntu-sdk-16.04", 4 | "architecture": "@CLICK_ARCH@", 5 | "hooks": { 6 | "filemanager": { 7 | "apparmor": "filemanager.apparmor", 8 | "desktop": "com.ubuntu.filemanager.desktop", 9 | "content-hub": "content-hub.json" 10 | } 11 | }, 12 | "icon": "filemanager.svg", 13 | "maintainer": "UBports ", 14 | "name": "com.ubuntu.filemanager", 15 | "title": "File Manager", 16 | "version": "0.6.0" 17 | } 18 | -------------------------------------------------------------------------------- /po/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(FindGettext) 2 | find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext) 3 | 4 | set(DOMAIN ${PROJECT_NAME}) 5 | set(POT_FILE ${DOMAIN}.pot) 6 | file(GLOB PO_FILES *.po) 7 | 8 | add_custom_target(${POT_FILE} ALL 9 | COMMENT "Generating translation template..." 10 | COMMAND ${INTLTOOL_EXTRACT} --update --type=gettext/ini 11 | --srcdir=${CMAKE_SOURCE_DIR} ${DESKTOP_FILE}.in.in 12 | COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} -o ${POT_FILE} 13 | -D ${CMAKE_CURRENT_SOURCE_DIR} 14 | -D ${CMAKE_CURRENT_BINARY_DIR} 15 | --from-code=UTF-8 16 | --c++ --qt --add-comments=TRANSLATORS 17 | --keyword=tr --keyword=tr:1,2 --keyword=N_ 18 | --package-name='${PROJECT}' 19 | --copyright-holder='Canonical Ltd.' 20 | ${I18N_SRC_FILES} 21 | COMMAND ${CMAKE_COMMAND} -E copy ${POT_FILE} ${CMAKE_CURRENT_SOURCE_DIR}) 22 | 23 | foreach(PO_FILE ${PO_FILES}) 24 | get_filename_component(LANG ${PO_FILE} NAME_WE) 25 | gettext_process_po_files(${LANG} ALL PO_FILES ${PO_FILE}) 26 | set(INSTALL_DIR ${CMAKE_INSTALL_LOCALEDIR}/${LANG}/LC_MESSAGES) 27 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo 28 | DESTINATION ${INSTALL_DIR} 29 | RENAME ${DOMAIN}.mo) 30 | endforeach(PO_FILE) 31 | -------------------------------------------------------------------------------- /po/po.pro: -------------------------------------------------------------------------------- 1 | ## This .pro file is used to create a Makefile with the necessary rules 2 | ## to create an initial translations template and to update it whenever 3 | ## there are new translatable strings in the project that are ready to be 4 | ## exposed to translators 5 | ## 6 | ## See the ../README.translations file for more information 7 | 8 | TEMPLATE = subdirs 9 | 10 | PROJECTNAME = $$system(basename ../*.qmlproject) 11 | PROJECTNAME = $$replace(PROJECTNAME,.qmlproject,) 12 | 13 | DESKTOPFILE = ../com.ubuntu.filemanager_filemanager.desktop.in 14 | 15 | SOURCECODE = ../*.qml 16 | 17 | BUILDDIR = ../.build 18 | DESKTOPFILETEMP = $${BUILDDIR}/com.ubuntu.filemanager_filemanager.desktop.in 19 | 20 | message("") 21 | message(" Project Name: $$PROJECTNAME ") 22 | message(" Source Code: $$SOURCECODE ") 23 | message("") 24 | message(" Run 'make pot' to generate the pot file from source code. ") 25 | message("") 26 | 27 | ## Generate pot file 'make pot' 28 | potfile.target = pot 29 | potfile.commands = xgettext \ 30 | -o $${PROJECTNAME}.pot \ 31 | --copyright=\"Canonical Ltd. \" \ 32 | --package-name $${PROJECTNAME} \ 33 | --qt --c++ --add-comments=TRANSLATORS \ 34 | --keyword=tr --keyword=tr:1,2 \ 35 | $${SOURCECODE} $${DESKTOPFILETEMP} 36 | potfile.depends = desktopfile 37 | QMAKE_EXTRA_TARGETS += potfile 38 | 39 | ## Do not use this rule directly. It's a dependency rule to 40 | ## generate an intermediate .js file to extract translatable 41 | ## strings from the .desktop file 42 | desktopfile.target = desktopfile 43 | desktopfile.commands = awk \'BEGIN { FS=\"=\" }; /Name/ {print \"var s = i18n.tr(\42\" \$$2 \"\42);\"}\' $${DESKTOPFILE} > $${DESKTOPFILETEMP} 44 | desktopfile.depends = makebuilddir 45 | QMAKE_EXTRA_TARGETS += desktopfile 46 | 47 | ## Dependency rule to create the temporary build dir 48 | makebuilddir.target = makebuilddir 49 | makebuilddir.commands = mkdir -p $${BUILDDIR} 50 | QMAKE_EXTRA_TARGETS += makebuilddir 51 | 52 | ## Rule to clean the products of the build 53 | clean.target = clean 54 | clean.commands = rm -Rf $${BUILDDIR} 55 | QMAKE_EXTRA_TARGETS += clean 56 | 57 | -------------------------------------------------------------------------------- /setup/gui/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/setup/gui/icon.png -------------------------------------------------------------------------------- /setup/gui/ubuntu-filemanager-app.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Terminal=false 5 | Exec=ubuntu-filemanager-app %u 6 | Icon=/snap/ubuntu-filemanager-app/current/usr/share/filemanager/filemanager64.png 7 | Name=File Manager 8 | Name[am]=የ ፋይል አስተዳዳሪ 9 | Name[ast]=Xestor de ficheros 10 | Name[be]=Кіраўнік файлаў 11 | Name[br]=Merer restroù 12 | Name[bs]=Menadžer datoteka 13 | Name[ca]=Gestor de fitxers 14 | Name[cs]=Správce souborů 15 | Name[de]=Dateiverwaltung 16 | Name[el]=Διαχειριστής αρχείων 17 | Name[en_GB]=File Manager 18 | Name[eo]=Dosieradministrilo 19 | Name[es]=Gestor de archivos 20 | Name[eu]=Fitxategi-kudeatzailea 21 | Name[fa]=مدیر پرونده 22 | Name[fi]=Tiedostoselain 23 | Name[fr]=Gestionnaire de fichiers 24 | Name[fr_CA]=Gestionnaire de fichiers 25 | Name[gd]=Manaidsear fhaidhlichean 26 | Name[gl]=Xestor de ficheiros 27 | Name[hu]=Fájlkezelő 28 | Name[id]=Manajer Berkas 29 | Name[it]=Gestore file 30 | Name[lv]=Datņu pārvaldnieks 31 | Name[nb]=Filbehandling 32 | Name[pa]=ਫ਼ਾਈਲ ਮੈਨੇਜਰ 33 | Name[pl]=Menedżer plików 34 | Name[pt]=Gestor de ficheiros 35 | Name[pt_BR]=Gerenciador de arquivos 36 | Name[shn]=တူဝ်ၸတ်းၵၢၼ် ၾၢႆႇ 37 | Name[sk]=Správca súborov 38 | Name[sl]=Upravljalnik datotek 39 | Name[sr]=Управник датотека 40 | Name[tr]=Dosya Yöneticisi 41 | Name[ug]=ھۆججەت باشقۇرغۇ 42 | Name[zh_CN]=文件管理器 43 | Name[zh_TW]=檔案管理員 44 | X-Ubuntu-Touch=true 45 | X-Ubuntu-Default-Department-ID=accessories 46 | X-Ubuntu-Splash-Show-Header=true 47 | X-Ubuntu-Splash-Color=#F5F5F5 48 | -------------------------------------------------------------------------------- /snap/ubuntu-filemanager-app.wrapper: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Overwrite snappy home dir and use the real home dir 4 | export HOME="/home/$USER" 5 | 6 | exec "$SNAP/usr/bin/filemanager" "$@" 7 | -------------------------------------------------------------------------------- /snapcraft.yaml: -------------------------------------------------------------------------------- 1 | name: ubuntu-filemanager-app 2 | version: 0.5 3 | summary: File Manager application 4 | description: Core File Manager application 5 | confinement: devmode # use "strict" to enforce system access only via declared interfaces 6 | grade: devel 7 | 8 | apps: 9 | ubuntu-filemanager-app: 10 | command: desktop-launch $SNAP/bin/ubuntu-filemanager-app "$@" 11 | plugs: [unity7, unity8, opengl, home, platform, mir] 12 | 13 | plugs: 14 | platform: 15 | interface: content 16 | content: ubuntu-app-platform1 17 | target: ubuntu-app-platform 18 | default-provider: ubuntu-app-platform 19 | 20 | parts: 21 | ubuntu-filemanager-app: 22 | plugin: cmake 23 | configflags: [-DCMAKE_INSTALL_PREFIX=/usr, -DCLICK_MODE=off] 24 | source: . 25 | build-packages: 26 | - cmake 27 | - gcc 28 | - g++ 29 | - intltool 30 | - qtbase5-dev 31 | - qtdeclarative5-dev 32 | - qt5-default 33 | - pkg-kde-tools 34 | - python3-all 35 | - libtag1-dev 36 | - libpam0g-dev 37 | - libsmbclient-dev 38 | 39 | stage-packages: 40 | - libsmbclient 41 | 42 | snap: 43 | - -usr/lib/python3 44 | - -usr/share/doc 45 | - -usr/include 46 | 47 | after: [desktop-ubuntu-app-platform] 48 | 49 | environment: 50 | source: snap/ 51 | plugin: dump 52 | organize: 53 | ubuntu-filemanager-app.wrapper: bin/ubuntu-filemanager-app 54 | 55 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(plugin) 2 | add_subdirectory(app) 3 | -------------------------------------------------------------------------------- /src/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE QML_SRCS *.qml *.js *.png *.svg) 2 | 3 | set(filemanager_SRCS 4 | main.cpp 5 | patharrowbackground.cpp 6 | patharrowbackground.h 7 | fmutils.cpp 8 | fmutils.h 9 | ${QML_SRCS} 10 | ) 11 | 12 | add_executable(filemanager ${filemanager_SRCS}) 13 | 14 | qt5_use_modules(filemanager Gui Qml Quick) 15 | target_link_libraries(filemanager stdc++) 16 | 17 | if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") 18 | add_custom_target(filemanager-qmlfiles ALL 19 | COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/qml ${CMAKE_CURRENT_BINARY_DIR} 20 | DEPENDS ${QMLFILES} 21 | ) 22 | endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") 23 | 24 | install(DIRECTORY qml DESTINATION ${DATA_DIR}) 25 | if(CLICK_MODE) 26 | install(TARGETS filemanager DESTINATION ${BIN_DIR}) 27 | else() 28 | install(TARGETS filemanager RUNTIME DESTINATION bin) 29 | endif() 30 | -------------------------------------------------------------------------------- /src/app/fmutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2015 Canonical, Ltd. 3 | Copyright (C) 2015, 2017 Stefano Verzegnassi 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License 3 as published by 7 | the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see http://www.gnu.org/licenses/. 16 | */ 17 | 18 | #ifndef FMUTILS_H 19 | #define FMUTILS_H 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | #define _(x) gettext(x) 26 | 27 | class FMUtils : public QObject 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | Q_INVOKABLE static bool exists(const QString &path); 33 | Q_INVOKABLE static bool copy(const QString &source, const QString &destination); 34 | 35 | Q_INVOKABLE static QString getFileBaseNameFromPath(const QString &filePath); 36 | Q_INVOKABLE static QString getFileNameFromPath(const QString &filePath); 37 | 38 | Q_INVOKABLE static QString basename(const QString &path); 39 | Q_INVOKABLE static bool pathExists(const QString &path); 40 | 41 | Q_INVOKABLE static QString pathName(const QString &path); 42 | Q_INVOKABLE static QString pathTitle(const QString &path); 43 | 44 | Q_INVOKABLE static QString newFileUniqueName(const QString &dirPath, const QString &fileName); 45 | 46 | Q_INVOKABLE static QString capitalize(const QString &string); 47 | }; 48 | 49 | #endif // FMUTILS_H 50 | -------------------------------------------------------------------------------- /src/app/patharrowbackground.cpp: -------------------------------------------------------------------------------- 1 | #include "patharrowbackground.h" 2 | 3 | #include 4 | #include 5 | 6 | PathArrowBackground::PathArrowBackground(QQuickItem *parent) 7 | : QQuickPaintedItem(parent) 8 | , m_color(Qt::white) 9 | , m_arrowWidth(16) 10 | { 11 | connect(this, SIGNAL(colorChanged()), this, SLOT(update())); 12 | connect(this, SIGNAL(arrowWidthChanged()), this, SLOT(update())); 13 | } 14 | 15 | void PathArrowBackground::paint(QPainter *painter) 16 | { 17 | QBrush brush(m_color); 18 | 19 | painter->setBrush(brush); 20 | painter->setPen(Qt::NoPen); 21 | painter->setRenderHint(QPainter::Antialiasing); 22 | 23 | const QPointF topLeftPoints[3] = { 24 | QPointF(boundingRect().left() - 1, 0), 25 | QPointF(boundingRect().left() + m_arrowWidth, 0), 26 | QPointF(boundingRect().left() + m_arrowWidth, boundingRect().top() + boundingRect().height() * 0.5) 27 | }; 28 | 29 | const QPointF bottomLeftPoints[3] = { 30 | QPointF(boundingRect().left() - 1, boundingRect().bottom()), 31 | QPointF(boundingRect().left() + m_arrowWidth, boundingRect().bottom()), 32 | QPointF(boundingRect().left() + m_arrowWidth, boundingRect().top() + boundingRect().height() * 0.5) 33 | }; 34 | 35 | const QPointF rightPoints[3] = { 36 | QPointF(boundingRect().right() - m_arrowWidth - 1, 0), 37 | QPointF(boundingRect().right(), boundingRect().top() + boundingRect().height() * 0.5), 38 | QPointF(boundingRect().right() - m_arrowWidth - 1, boundingRect().bottom()), 39 | }; 40 | 41 | painter->drawConvexPolygon(topLeftPoints, 3); 42 | painter->drawConvexPolygon(bottomLeftPoints, 3); 43 | painter->drawConvexPolygon(rightPoints, 3); 44 | 45 | painter->drawRect(m_arrowWidth, 0, boundingRect().width() - m_arrowWidth * 2, boundingRect().height()); 46 | } 47 | -------------------------------------------------------------------------------- /src/app/patharrowbackground.h: -------------------------------------------------------------------------------- 1 | #ifndef PATHARROWBACKGROUND_H 2 | #define PATHARROWBACKGROUND_H 3 | 4 | #include 5 | 6 | class PathArrowBackground : public QQuickPaintedItem 7 | { 8 | Q_OBJECT 9 | Q_PROPERTY(QColor color MEMBER m_color NOTIFY colorChanged) 10 | Q_PROPERTY(int arrowWidth MEMBER m_arrowWidth NOTIFY arrowWidthChanged) 11 | 12 | public: 13 | PathArrowBackground(QQuickItem *parent = 0); 14 | 15 | Q_SIGNALS: 16 | void colorChanged(); 17 | void arrowWidthChanged(); 18 | 19 | protected: 20 | void paint(QPainter *painter) override; 21 | 22 | private: 23 | QColor m_color; 24 | int m_arrowWidth; 25 | }; 26 | 27 | #endif // PATHARROWBACKGROUND_H 28 | -------------------------------------------------------------------------------- /src/app/qml/actions/AddBookmark.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | iconName: "bookmark-new" 6 | text: i18n.tr("Add bookmark") 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/actions/ArchiveExtract.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | iconName: "application-x-archive-symbolic" 6 | text: i18n.tr("Extract archive") 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/actions/Delete.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | text: i18n.tr("Delete") 6 | // TODO: temporary 7 | iconName: "edit-delete" 8 | } 9 | -------------------------------------------------------------------------------- /src/app/qml/actions/FileClearSelection.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | property int clipboardUrlsCounter 6 | 7 | iconName: "edit-clear" 8 | text: i18n.tr("Clear clipboard") 9 | visible: clipboardUrlsCounter > 0 10 | } 11 | -------------------------------------------------------------------------------- /src/app/qml/actions/FileCopy.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | text: i18n.tr("Copy") 6 | // TODO: temporary. 7 | iconName: "edit-copy" 8 | } 9 | -------------------------------------------------------------------------------- /src/app/qml/actions/FileCut.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | text: i18n.tr("Cut") 6 | // TODO: temporary 7 | iconName: "edit-cut" 8 | } 9 | -------------------------------------------------------------------------------- /src/app/qml/actions/FilePaste.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Authored by: Arto Jalkanen 17 | * Niklas Wenzel 18 | */ 19 | 20 | import QtQuick 2.4 21 | import Ubuntu.Components 1.3 22 | 23 | Action { 24 | property int clipboardUrlsCounter 25 | 26 | // Translation message was implemented according to: 27 | // http://developer.ubuntu.com/api/qml/sdk-14.04/Ubuntu.Components.i18n/ 28 | // It allows correct translation for languages with more than two plural forms: 29 | // http://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html 30 | text: i18n.tr("Paste %1 file", "Paste %1 files", clipboardUrlsCounter).arg(clipboardUrlsCounter) 31 | visible: clipboardUrlsCounter > 0 32 | iconName: "edit-paste" 33 | } 34 | -------------------------------------------------------------------------------- /src/app/qml/actions/GoBack.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | text: i18n.tr("Go back") 6 | iconName: "back" 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/actions/GoNext.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | text: i18n.tr("Go next") 6 | iconName: "next" 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/actions/GoTo.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | iconName: "find" 6 | text: i18n.tr("Go To") 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/actions/NewItem.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | iconName: "add" 6 | text: i18n.tr("New Item") 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/actions/PlacesBookmarks.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | iconName: "navigation-menu" 6 | text: i18n.tr("Places") 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/actions/Properties.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | iconName: "info" 6 | text: i18n.tr("Properties") 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/actions/Rename.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | text: i18n.tr("Rename") 6 | // TODO: temporary 7 | iconName: "edit" 8 | } 9 | -------------------------------------------------------------------------------- /src/app/qml/actions/Search.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | iconName: "find" 6 | } 7 | -------------------------------------------------------------------------------- /src/app/qml/actions/Select.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | text: i18n.tr("Select") 6 | } 7 | -------------------------------------------------------------------------------- /src/app/qml/actions/SelectUnselectAll.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | property bool selectedAll 6 | text: selectedAll ? i18n.tr("Select None") : i18n.tr("Select All") 7 | } 8 | 9 | -------------------------------------------------------------------------------- /src/app/qml/actions/Settings.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | iconName: "filters" 6 | text: i18n.tr("Settings") 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/actions/Share.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | text: i18n.tr("Share") 6 | iconName: "share" 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/actions/ShowPanel.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | iconName: "navigation-menu" 6 | } 7 | -------------------------------------------------------------------------------- /src/app/qml/actions/TabsAdd.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | text: i18n.tr("Add tab") 6 | iconName: "add" 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/actions/TabsCloseThis.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | text: i18n.tr("Close this tab") 6 | } 7 | -------------------------------------------------------------------------------- /src/app/qml/actions/TabsOpenInNewTab.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | text: i18n.tr("Open in a new tab") 6 | } 7 | -------------------------------------------------------------------------------- /src/app/qml/actions/UnlockFullAccess.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Action { 5 | //iconName: "lock" 6 | text: i18n.tr("Unlock") 7 | } 8 | -------------------------------------------------------------------------------- /src/app/qml/authentication/assets/fingerprint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/app/qml/authentication/assets/fingerprint.png -------------------------------------------------------------------------------- /src/app/qml/backend/GlobalSettings.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Stefano Verzegnassi 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License 3 as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see http://www.gnu.org/licenses/. 16 | */ 17 | 18 | import QtQuick 2.4 19 | import Ubuntu.Components 1.3 20 | import Qt.labs.settings 1.0 21 | 22 | Settings { 23 | property bool collapsedSidebar: false 24 | property int viewMethod: 0 // 0=List; 1=Grid 25 | property bool showHidden: false 26 | property int sortOrder: 0 // 0=Ascending; 1=Descending 27 | property int sortBy: 0 // 0=Name; 1=Date 28 | property int sidebarWidth: units.gu(20) 29 | property int gridSize: 1 // 0=S; 1=M; 2=L; 3=XL 30 | property int listSize: 1 // 0=S; 1=M; 2=L; 3=XL 31 | property bool darkTheme: false 32 | } 33 | -------------------------------------------------------------------------------- /src/app/qml/components/BottomPanelStack.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Rectangle { 5 | id: rootItem 6 | 7 | default property alias layoutContent: layout.children 8 | 9 | color: theme.palette.normal.background 10 | height: layout.height 11 | 12 | anchors { 13 | left: parent.left 14 | right: parent.right 15 | bottom: parent.bottom 16 | } 17 | 18 | Column { 19 | id: layout 20 | anchors { 21 | left: parent.left 22 | right: parent.right 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/app/qml/components/EmptyState.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014, 2015, 2016 Canonical Ltd 3 | * 4 | * This file is part of Ubuntu Clock App 5 | * 6 | * Ubuntu Clock App is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 3 as 8 | * published by the Free Software Foundation. 9 | * 10 | * Ubuntu Clock App is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | import QtQuick 2.4 20 | import Ubuntu.Components 1.3 21 | 22 | /* 23 | Component which displays an empty state (approved by design). It offers an 24 | icon, title and subtitle to describe the empty state. 25 | */ 26 | 27 | Column { 28 | id: emptyState 29 | spacing: units.gu(2) 30 | width: units.gu(36) 31 | 32 | // Public APIs 33 | default property alias iconPlaceholder: iconContainer.data 34 | property alias iconName: emptyIcon.name 35 | property alias title: emptyLabel.text 36 | property alias subTitle: emptySublabel.text 37 | 38 | property alias controlComponent: controlLoader.sourceComponent 39 | 40 | Item { 41 | width: childrenRect.width 42 | height: childrenRect.height 43 | Icon { 44 | id: emptyIcon 45 | height: visible ? units.gu(10) : 0 46 | width: visible ? height : 0 47 | color: "#BBBBBB" 48 | visible: name || source 49 | } 50 | Row { 51 | id: iconContainer 52 | anchors.horizontalCenter: parent.horizontalCenter 53 | } 54 | } 55 | 56 | Label { 57 | id: emptyLabel 58 | width: parent.width 59 | horizontalAlignment: Text.AlignLeft 60 | textSize: Label.XLarge 61 | 62 | elide: Text.ElideRight 63 | wrapMode: Text.WordWrap 64 | maximumLineCount: 2 65 | } 66 | 67 | Label { 68 | id: emptySublabel 69 | width: parent.width 70 | horizontalAlignment: Text.AlignLeft 71 | textSize: Label.Medium 72 | 73 | elide: Text.ElideRight 74 | wrapMode: Text.WordWrap 75 | } 76 | 77 | Loader { 78 | id: controlLoader 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/app/qml/components/HorizontalOptionSelector.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Stefano Verzegnassi 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | */ 16 | 17 | import QtQuick 2.4 18 | import Ubuntu.Components 1.3 19 | 20 | ListItem { 21 | id: rootItem 22 | height: layout.height 23 | 24 | property int selectedIndex: -1 25 | property var model 26 | 27 | property string title 28 | property string subtitle 29 | property string summary 30 | 31 | ListItemLayout { 32 | id: layout 33 | 34 | anchors { left: parent.left; right: parent.right } 35 | anchors.leftMargin: units.gu(-2) 36 | anchors.rightMargin: units.gu(-2) 37 | 38 | title.text: rootItem.title 39 | title.textSize: Label.Medium 40 | subtitle.text: rootItem.subtitle 41 | subtitle.textSize: Label.Medium 42 | summary.text: rootItem.summary 43 | summary.textSize: Label.Medium 44 | 45 | Row { 46 | id: choicesRow 47 | SlotsLayout.position: SlotsLayout.Last 48 | height: units.gu(4) 49 | 50 | Repeater { 51 | model: rootItem.model 52 | 53 | delegate: AbstractButton { 54 | id: del 55 | property bool isSelected: model.index == rootItem.selectedIndex 56 | 57 | onClicked: rootItem.selectedIndex = model.index 58 | 59 | width: delLabel.width + units.gu(2) 60 | height: parent.height 61 | 62 | Rectangle { 63 | anchors.fill: parent 64 | color: "#CDCDCD" 65 | visible: del.pressed 66 | } 67 | 68 | Label { 69 | id: delLabel 70 | anchors.centerIn: parent 71 | text: modelData 72 | textSize: Label.Medium 73 | color: isSelected ? theme.palette.normal.backgroundText : theme.palette.disabled.backgroundText 74 | } 75 | } 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/app/qml/components/SectionDivider.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Stefano Verzegnassi 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License 3 as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see http://www.gnu.org/licenses/. 16 | */ 17 | 18 | import QtQuick 2.4 19 | import Ubuntu.Components 1.3 20 | import QtQuick.Layouts 1.1 21 | 22 | Item { 23 | property alias text: label.text 24 | 25 | anchors { left: parent.left; right: parent.right } 26 | height: units.gu(4) 27 | 28 | RowLayout { 29 | anchors { 30 | left: parent.left; 31 | right: parent.right 32 | verticalCenter: parent.bottom 33 | } 34 | 35 | spacing: units.gu(2) 36 | 37 | Rectangle { 38 | height: units.dp(1) 39 | color: theme.palette.normal.base 40 | Layout.preferredWidth: units.gu(7) 41 | Layout.alignment: Qt.AlignVCenter 42 | } 43 | 44 | Label { 45 | id: label 46 | Layout.alignment: Qt.AlignVCenter 47 | textSize: Label.Small 48 | color: theme.palette.normal.backgroundSecondaryText 49 | } 50 | 51 | Rectangle { 52 | height: units.dp(1) 53 | color: theme.palette.normal.base 54 | Layout.fillWidth: true 55 | Layout.alignment: Qt.AlignVCenter 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/app/qml/components/SidebarPageLayout.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | import "../actions" as Actions 5 | 6 | PageTreeNode { 7 | id: rootItem 8 | anchors.fill: parent 9 | 10 | property alias sidebarLoader: sidePageLoader 11 | property alias mainLoader: mainLoader 12 | 13 | property bool sidebarActive: true 14 | property alias sidebarWidth: sidebar.width 15 | property alias sidebarMinimumWidth: sidebar.minimumWidth 16 | property alias sidebarMaximumWidth: sidebar.maximumWidth 17 | 18 | property alias sidebarResizing: sidebar.resizing 19 | 20 | property Action showPanelAction: Actions.ShowPanel { 21 | checkable: true 22 | visible: enabled 23 | enabled: rootItem.sidebarActive 24 | } 25 | 26 | ResizeableSidebar { 27 | id: sidebar 28 | visible: showPanelAction.checked && sidebarActive 29 | anchors { 30 | left: parent.left 31 | leftMargin: sidebar.visible ? 0 : -sidebar.width 32 | } 33 | 34 | Behavior on anchors.leftMargin { 35 | UbuntuNumberAnimation {} 36 | } 37 | 38 | Loader { 39 | id: sidePageLoader 40 | anchors.fill: parent 41 | onLoaded: console.log("[SidebarPageLayout] Sidebar loaded") 42 | } 43 | } 44 | 45 | Loader { 46 | id: mainLoader 47 | anchors { 48 | left: sidebar.right 49 | right: parent.right 50 | top: parent.top 51 | bottom: parent.bottom 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/app/qml/components/TextualButtonStyle.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical, Ltd. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | */ 16 | 17 | import QtQuick 2.4 18 | import Ubuntu.Components 1.3 19 | 20 | Component { 21 | id: textualButton 22 | AbstractButton { 23 | id: button 24 | property bool smallText: action.hasOwnProperty("smallText") 25 | property bool showText: action.hasOwnProperty("showText") 26 | action: modelData 27 | width: layout.width + units.gu(4) 28 | height: parent.height 29 | Rectangle { 30 | color: UbuntuColors.slate 31 | opacity: 0.1 32 | anchors.fill: parent 33 | visible: button.pressed 34 | } 35 | Row { 36 | id: layout 37 | anchors.centerIn: parent 38 | spacing: units.gu(1) 39 | Icon { 40 | anchors.verticalCenter: parent.verticalCenter 41 | width: visible ? units.gu(2) : 0 42 | height: width 43 | name: action.iconName 44 | source: action.iconSource 45 | visible: (name != "") || (source != "") 46 | color: { 47 | if (button.enabled) 48 | return text === i18n.tr("Pick") ? theme.palette.selected.backgroundText : theme.palette.normal.backgroundText 49 | 50 | return theme.palette.disabled.backgroundText 51 | } 52 | } 53 | Label { 54 | anchors.verticalCenter: parent.verticalCenter 55 | text: action.text 56 | font.weight: text === i18n.tr("Pick") ? Font.Normal : Font.Light 57 | // Hide text from overflow button of ActionBar 58 | visible: text !== "More" && !button.showText 59 | width: visible ? paintedWidth : 0 60 | textSize: button.smallText ? Label.Small : Label.Medium 61 | color: { 62 | if (button.enabled) 63 | return text === i18n.tr("Pick") ? theme.palette.selected.backgroundText : theme.palette.normal.backgroundText 64 | 65 | return theme.palette.disabled.backgroundText 66 | } 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/app/qml/components/VerticalDivider.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Stefano Verzegnassi 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License 3 as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see http://www.gnu.org/licenses/. 16 | */ 17 | 18 | import QtQuick 2.4 19 | import Ubuntu.Components 1.3 20 | 21 | Rectangle { 22 | width: units.dp(1) 23 | color: theme.palette.normal.base 24 | } 25 | -------------------------------------------------------------------------------- /src/app/qml/content-hub/FileOpener.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Authored by: Arto Jalkanen 17 | */ 18 | import QtQuick 2.4 19 | import Ubuntu.Components 1.3 20 | 21 | import Ubuntu.Content 1.3 22 | 23 | import "contenttyperesolver.js" as Resolver 24 | 25 | Page { 26 | id: root 27 | title: i18n.tr("Open with") 28 | 29 | property var activeTransfer 30 | 31 | property string fileUrl 32 | property bool share: false 33 | 34 | Component.onCompleted: { 35 | var contentType = Resolver.resolveContentType(fileUrl) 36 | console.log("Resolved contenttype: " + contentType) 37 | peerPicker.contentType = contentType 38 | } 39 | 40 | Component { 41 | id: resultComponent 42 | ContentItem {} 43 | } 44 | 45 | function __exportItemsWhenPossible(url) { 46 | if (root.activeTransfer.state === ContentTransfer.InProgress) 47 | { 48 | root.activeTransfer.items = [ resultComponent.createObject(root, {"url": url}) ]; 49 | root.activeTransfer.state = ContentTransfer.Charged; 50 | } 51 | } 52 | ContentPeerPicker { 53 | id: peerPicker 54 | showTitle: false 55 | 56 | // Type of handler: Source, Destination, or Share 57 | handler: root.share ? ContentHandler.Share : ContentHandler.Destination 58 | contentType: ContentType.Pictures 59 | 60 | onPeerSelected: { 61 | root.activeTransfer = peer.request(); 62 | pageStack.pop(); 63 | __exportItemsWhenPossible(root.fileUrl) 64 | } 65 | 66 | onCancelPressed: { 67 | pageStack.pop(); 68 | } 69 | } 70 | 71 | Connections { 72 | target: root.activeTransfer 73 | onStateChanged: { 74 | console.log("curTransfer StateChanged: " + root.activeTransfer.state); 75 | __exportItemsWhenPossible(root.fileUrl) 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/ConfirmExtractDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | import Ubuntu.Components.Popups 1.3 4 | 5 | import "templates" 6 | 7 | ConfirmDialog { 8 | id: rootItem 9 | 10 | property string filePath 11 | property string fileName 12 | property string archiveType 13 | property var folderModel 14 | 15 | title: i18n.tr("Extract Archive") 16 | text: i18n.tr("Are you sure you want to extract '%1' here?").arg(fileName) 17 | 18 | onAccepted: { 19 | folderModel.extractArchive(filePath, fileName, archiveType) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/ConfirmMultipleDeleteDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | import Ubuntu.Components.Popups 1.3 4 | 5 | import "templates" 6 | 7 | ConfirmDialog { 8 | id: rootItem 9 | 10 | property var folderModel 11 | property var fileOperationDialog 12 | property var paths 13 | 14 | title: i18n.tr("Delete") 15 | text: i18n.tr("Are you sure you want to permanently delete '%1'?").arg(i18n.tr("these files")) 16 | 17 | onAccepted: { 18 | fileOperationDialog.startOperation(i18n.tr("Deleting files")) 19 | console.log("Doing delete") 20 | folderModel.removePaths(paths) 21 | selectionManager.clear() 22 | fileSelectorMode = false 23 | fileSelector.fileSelectorComponent = null 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/ConfirmRenameDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | import Ubuntu.Components.Popups 1.3 4 | 5 | import "templates" 6 | 7 | ConfirmDialogWithInput { 8 | id: rootItem 9 | 10 | property var folderModel 11 | 12 | // IMPROVE: this does not seem good: the backend expects row and new name. 13 | // But what if new files are added/deleted in the background while user is 14 | // entering the new name? The indices change and wrong file is renamed. 15 | // Perhaps the backend should take as parameters the "old name" and "new name"? 16 | // This is not currently a problem since the backend does not poll changes in 17 | // the filesystem, but may be a problem in the future. 18 | property int modelRow 19 | 20 | title: i18n.tr("Rename") 21 | text: i18n.tr("Enter a new name") 22 | } 23 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/ConfirmSingleDeleteDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | import Ubuntu.Components.Popups 1.3 4 | 5 | import "templates" 6 | 7 | ConfirmDialog { 8 | id: rootItem 9 | 10 | property var folderModel 11 | property var fileOperationDialog 12 | property string filePath 13 | property string fileName 14 | 15 | title: i18n.tr("Delete") 16 | text: i18n.tr("Are you sure you want to permanently delete '%1'?").arg(fileName) 17 | 18 | onAccepted: { 19 | console.log("Delete accepted for filePath, fileName", filePath, fileName) 20 | 21 | fileOperationDialog.startOperation(i18n.tr("Deleting files")) 22 | console.log("Doing delete") 23 | folderModel.rm(filePath) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/CreateItemDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | import Ubuntu.Components.Popups 1.3 4 | 5 | // TODO: Path validation in inputText: disable buttons if new object name is not valid 6 | // TODO: Handle failure of mkpath/touch 7 | 8 | Dialog { 9 | id: dialog 10 | 11 | property var folderModel 12 | 13 | title: i18n.tr("Create Item") 14 | text: i18n.tr("Enter name for new item") 15 | 16 | TextField { 17 | id: inputText 18 | placeholderText: i18n.tr("Item name") 19 | focus: true 20 | } 21 | 22 | Button { 23 | id: createFile 24 | text: i18n.tr("Create file") 25 | color: UbuntuColors.green 26 | onClicked: { 27 | inputText.focus = false 28 | console.log("Create file accepted", inputText.text) 29 | 30 | if (inputText.text !== '') { 31 | var fileName = inputText.text.trim() 32 | folderModel.touch(fileName) 33 | } else { 34 | console.log("Empty file name, ignored") 35 | } 36 | 37 | PopupUtils.close(dialog) 38 | } 39 | } 40 | 41 | Button { 42 | id: createFolder 43 | text: i18n.tr("Create Folder") 44 | color: UbuntuColors.green 45 | onClicked: { 46 | inputText.focus = false 47 | console.log("Create folder accepted", inputText.text) 48 | if (inputText.text !== '') { 49 | var folderName = inputText.text.trim() 50 | folderModel.mkdir(folderName) 51 | } else { 52 | console.log("Empty directory name, ignored") 53 | } 54 | PopupUtils.close(dialog) 55 | } 56 | } 57 | 58 | Button { 59 | id: cancelButton 60 | text: i18n.tr("Cancel") 61 | color: UbuntuColors.graphite 62 | onClicked: { 63 | PopupUtils.close(dialog) 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/ExtractingDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | import Ubuntu.Components.Popups 1.3 4 | 5 | Dialog { 6 | id: dialog 7 | modal: true 8 | property string fileName: "" 9 | property var archives 10 | 11 | Row { 12 | id: row 13 | width: parent.width 14 | spacing: units.gu(2) 15 | 16 | ActivityIndicator { 17 | id: loadingSpinner 18 | running: true 19 | anchors.verticalCenter: parent.verticalCenter 20 | } 21 | 22 | Label { 23 | text: i18n.tr("Extracting archive '%1'").arg(fileName) 24 | color: UbuntuColors.slate 25 | anchors.verticalCenter: parent.verticalCenter 26 | width: row.width - loadingSpinner.width - row.spacing 27 | maximumLineCount: 2 28 | wrapMode: Text.WrapAnywhere 29 | elide: Text.ElideRight 30 | } 31 | } 32 | 33 | Button { 34 | id: cancelButton 35 | text: i18n.tr("Cancel") 36 | visible: true 37 | onClicked: { 38 | archives.cancelArchiveExtraction() 39 | } 40 | } 41 | 42 | Button { 43 | id: okButton 44 | text: i18n.tr("OK") 45 | visible: false 46 | onClicked: { 47 | PopupUtils.close(dialog) 48 | } 49 | } 50 | 51 | Connections { 52 | target: archives 53 | onFinished: { 54 | if (success) { 55 | PopupUtils.close(dialog) 56 | } else { 57 | row.visible = false 58 | cancelButton.visible = false 59 | title = i18n.tr("Extracting failed") 60 | text = i18n.tr("Extracting the archive '%1' failed.").arg(fileName) 61 | okButton.visible = true 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/FileActionDialog.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Authored by: Arto Jalkanen 17 | */ 18 | import QtQuick 2.4 19 | import Ubuntu.Components 1.3 20 | import Ubuntu.Components.Popups 1.3 21 | import org.nemomobile.folderlistmodel 1.0 22 | 23 | Dialog { 24 | id: root 25 | 26 | property string fileName 27 | property string filePath 28 | property FolderListModel folderListModel 29 | 30 | title: i18n.tr("Choose action") 31 | text: i18n.tr("For file: %1").arg(fileName) 32 | 33 | Button { 34 | objectName: "openButton" 35 | text: i18n.tr("Open") 36 | onClicked: { 37 | console.log("Opening file", filePath) 38 | openLocalFile(model.filePath) 39 | onClicked: PopupUtils.close(root) 40 | } 41 | } 42 | 43 | Button { 44 | objectName: "cancelButton" 45 | text: i18n.tr("Cancel") 46 | onClicked: PopupUtils.close(root) 47 | 48 | gradient: Gradient { 49 | GradientStop { 50 | position: 0 51 | color: "gray" 52 | } 53 | 54 | GradientStop { 55 | position: 1 56 | color: "lightgray" 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/NotifyDialog.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Authored by: Arto Jalkanen 17 | */ 18 | import QtQuick 2.4 19 | import Ubuntu.Components 1.3 20 | import Ubuntu.Components.Popups 1.3 21 | 22 | Dialog { 23 | id: root 24 | 25 | Button { 26 | color: UbuntuColors.graphite 27 | text: i18n.tr("OK") 28 | onClicked: { 29 | PopupUtils.close(root) 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/OpenArchiveDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | import Ubuntu.Components.Popups 1.3 4 | 5 | Dialog { 6 | id: dialog 7 | modal: true 8 | title: i18n.tr("Archive file") 9 | text: i18n.tr("Do you want to extract the archive here?") 10 | property string filePath 11 | property string fileName 12 | property string archiveType 13 | property var folderListPage 14 | property var folderModel 15 | 16 | Button { 17 | id: extractButton 18 | text: i18n.tr("Extract archive") 19 | color: UbuntuColors.green 20 | onClicked: { 21 | PopupUtils.close(dialog) 22 | folderModel.extractArchive(filePath, fileName, archiveType) 23 | } 24 | } 25 | 26 | Button { 27 | id: openExternallyButton 28 | text: i18n.tr("Open with another app") 29 | color: UbuntuColors.red 30 | onClicked: { 31 | PopupUtils.close(dialog) 32 | openLocalFile(filePath) 33 | } 34 | } 35 | 36 | Button { 37 | id: cancelButton 38 | text: i18n.tr("Cancel") 39 | color: UbuntuColors.graphite 40 | onClicked: { 41 | PopupUtils.close(dialog) 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/OpenWithDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | import Ubuntu.Components.Popups 1.3 4 | 5 | Dialog { 6 | id: dialog 7 | modal: true 8 | title: i18n.tr("Open file") 9 | text: i18n.tr("What do you want to do with the clicked file?") 10 | property var model 11 | 12 | property bool previewButtonVisible: false 13 | property bool extractButtonVisible: false 14 | 15 | signal showPreview() 16 | signal extractArchive() 17 | signal openWith() 18 | signal showProperties() 19 | 20 | Button { 21 | id: previewButton 22 | text: i18n.tr("Preview") 23 | color: UbuntuColors.green 24 | visible: previewButtonVisible 25 | onClicked: { 26 | PopupUtils.close(dialog) 27 | showPreview() 28 | } 29 | } 30 | 31 | Button { 32 | id: extractButton 33 | text: i18n.tr("Extract archive") 34 | color: UbuntuColors.green 35 | visible: extractButtonVisible 36 | onClicked: { 37 | PopupUtils.close(dialog) 38 | extractArchive() 39 | } 40 | } 41 | 42 | Button { 43 | id: openExternallyButton 44 | text: i18n.tr("Open with another app") 45 | color: UbuntuColors.green 46 | onClicked: { 47 | PopupUtils.close(dialog) 48 | openWith() 49 | } 50 | } 51 | 52 | Button { 53 | id: propertiesButton 54 | text: i18n.tr("Properties") 55 | color: UbuntuColors.blue 56 | onClicked: { 57 | PopupUtils.close(dialog) 58 | showProperties() 59 | } 60 | } 61 | 62 | Button { 63 | id: cancelButton 64 | text: i18n.tr("Cancel") 65 | color: UbuntuColors.graphite 66 | onClicked: { 67 | PopupUtils.close(dialog) 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/templates/ConfirmDialog.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Authored by: Arto Jalkanen 17 | */ 18 | import QtQuick 2.4 19 | import Ubuntu.Components 1.3 20 | import Ubuntu.Components.Popups 1.3 21 | 22 | Dialog { 23 | id: root 24 | 25 | signal accepted 26 | signal rejected 27 | 28 | Button { 29 | id: okButton 30 | objectName: "okButton" 31 | text: i18n.tr("OK") 32 | onClicked: { 33 | accepted() 34 | PopupUtils.close(root) 35 | } 36 | } 37 | 38 | Button { 39 | id: cancelButton 40 | objectName: "cancelButton" 41 | text: i18n.tr("Cancel") 42 | 43 | gradient: Gradient { 44 | GradientStop { 45 | position: 0 46 | color: "gray" 47 | } 48 | 49 | GradientStop { 50 | position: 1 51 | color: "lightgray" 52 | } 53 | } 54 | 55 | onClicked: { 56 | rejected() 57 | PopupUtils.close(root) 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/app/qml/dialogs/templates/ConfirmDialogWithInput.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Authored by: Arto Jalkanen 17 | */ 18 | import QtQuick 2.4 19 | import Ubuntu.Components 1.3 20 | import Ubuntu.Components.Popups 1.3 21 | 22 | Dialog { 23 | id: root 24 | 25 | property alias inputText: input.text 26 | property alias placeholderText: input.placeholderText 27 | signal accepted(var text) 28 | signal rejected 29 | 30 | Component.onCompleted: { 31 | // Need to force active focus to input, otherwise the parent object that created this 32 | // dialog will continue to have active focus. 33 | input.forceActiveFocus() 34 | } 35 | 36 | TextField { 37 | id: input 38 | objectName: "inputField" 39 | focus: true 40 | // Avoid need to press enter to make "Ok" button enabled. 41 | inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase 42 | validator: RegExpValidator { 43 | regExp: /.+/ 44 | } 45 | } 46 | 47 | Button { 48 | objectName: "okButton" 49 | text: i18n.tr("OK") 50 | enabled: input.acceptableInput 51 | color: UbuntuColors.green 52 | onClicked: { 53 | accepted(input.text) 54 | PopupUtils.close(root) 55 | } 56 | } 57 | 58 | Button { 59 | objectName: "cancelButton" 60 | text: i18n.tr("Cancel") 61 | color: UbuntuColors.graphite 62 | 63 | onClicked: { 64 | rejected() 65 | PopupUtils.close(root) 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/app/qml/panels/template/Panel.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | Item { 5 | id: rootItem 6 | anchors { left: parent.left; right: parent.right } 7 | height: visible ? units.gu(6) : 0 8 | enabled: visible 9 | } 10 | -------------------------------------------------------------------------------- /src/app/qml/ui/FolderListPageDefaultHeader.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | import Ubuntu.Components.Popups 1.3 4 | 5 | import "../components" as Components 6 | import "../actions" as FMActions 7 | 8 | PageHeader { 9 | id: rootItem 10 | 11 | // temp 12 | property var fileOperationDialog 13 | property var folderModel 14 | property var showPanelAction 15 | 16 | title: FmUtils.basename(folderModel.path) 17 | 18 | contents: ListItemLayout { 19 | anchors.verticalCenter: parent.verticalCenter 20 | title.text: rootItem.title 21 | subtitle.text: i18n.tr("%1 item", "%1 items", folderModel.count).arg(folderModel.count) 22 | } 23 | 24 | extension: Components.PathHistoryRow { 25 | folderModel: rootItem.folderModel 26 | } 27 | 28 | FMActions.GoBack { 29 | id: goBackAction 30 | onTriggered: folderModel.goBack() 31 | } 32 | 33 | FMActions.PlacesBookmarks { 34 | id: placesBookmarkAction 35 | onTriggered: { 36 | var pp = pageStack.push(Qt.resolvedUrl("PlacesPage.qml"), { folderModel: rootItem.folderModel }) 37 | pp.pathClicked.connect(function() { 38 | pp.pageStack.pop() 39 | }) 40 | } 41 | } 42 | 43 | leadingActionBar.actions: showPanelAction.visible ? showPanelAction : placesBookmarkAction 44 | 45 | trailingActionBar.numberOfSlots: 2 46 | trailingActionBar.actions: [ 47 | FMActions.Settings { 48 | onTriggered: PopupUtils.open(Qt.resolvedUrl("ViewPopover.qml"), mainView, { folderListModel: folderModel.model }) 49 | } 50 | ] 51 | 52 | // *** STYLE HINTS *** 53 | 54 | StyleHints { dividerColor: "transparent" } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /src/app/qml/ui/FolderListPageSelectionHeader.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | import Ubuntu.Components.Popups 1.3 4 | 5 | import "../components" as Components 6 | import "../actions" as FMActions 7 | 8 | PageHeader { 9 | id: rootItem 10 | 11 | property var folderModel 12 | property var selectionManager: folderModel.model.selectionObject 13 | title: FmUtils.basename(folderModel.path) 14 | 15 | contents: ListItemLayout { 16 | anchors.verticalCenter: parent.verticalCenter 17 | subtitle.text: rootItem.title 18 | title.text: i18n.tr("%1 item selected", "%1 items selected", folderModel.model.selectionObject.counter).arg(folderModel.model.selectionObject.counter) 19 | } 20 | 21 | extension: Components.PathHistoryRow { 22 | folderModel: rootItem.folderModel 23 | } 24 | 25 | leadingActionBar.actions: Action { 26 | text: i18n.tr("Cancel") 27 | iconName: "close" 28 | onTriggered: { 29 | console.log("FileSelector cancelled") 30 | selectionManager.clear() 31 | fileSelectorMode = false 32 | fileSelector.fileSelectorComponent = null 33 | } 34 | } 35 | 36 | trailingActionBar.anchors.rightMargin: 0 37 | trailingActionBar.delegate: Components.TextualButtonStyle {} 38 | trailingActionBar.actions: FMActions.SelectUnselectAll { 39 | selectedAll: selectionManager.selectedAll 40 | onTriggered: { 41 | if (selectionManager.selectedAll) { 42 | selectionManager.clear() 43 | } else { 44 | selectionManager.selectAll() 45 | } 46 | } 47 | } 48 | 49 | 50 | // *** STYLE HINTS *** 51 | 52 | StyleHints { dividerColor: "transparent" } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/app/qml/ui/PlacesPage.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | 4 | import "../backend" 5 | import "../components" as Components 6 | import "../actions" as FMActions 7 | 8 | Page { 9 | id: root 10 | 11 | property FolderListModel folderModel 12 | 13 | signal pathClicked() 14 | 15 | header: PageHeader { 16 | title: i18n.tr("Places") 17 | 18 | /*trailingActionBar { 19 | anchors.rightMargin: 0 20 | delegate: Components.TextualButtonStyle {} 21 | actions: Action { 22 | text: i18n.tr("Edit") 23 | onTriggered: rootItem.showEditSources() 24 | } 25 | }*/ 26 | 27 | StyleHints { dividerColor: "transparent" } 28 | } 29 | 30 | ScrollView { 31 | id: scrollView 32 | anchors.fill: parent 33 | anchors.topMargin: root.header.height 34 | 35 | ListView { 36 | anchors.fill: parent 37 | model: folderModel.places 38 | 39 | delegate: ListItem { 40 | divider.visible: false 41 | height: units.gu(6) 42 | 43 | Rectangle { 44 | anchors.fill: parent 45 | color: Qt.rgba(0, 0, 0, 0.2) 46 | visible: model.path == folderModel.path 47 | } 48 | 49 | ListItemLayout { 50 | anchors.fill: parent 51 | title.text: FmUtils.pathTitle(model.path) 52 | 53 | Icon { 54 | SlotsLayout.position: SlotsLayout.Leading 55 | width: units.gu(4); height: width 56 | name: folderModel.model.getIcon(model.path) 57 | } 58 | } 59 | 60 | leadingActions: ListItemActions { 61 | actions: FMActions.Delete { 62 | visible: enabled 63 | enabled: !folderModel.places.isDefaultLocation(model.path) 64 | && !folderModel.places.isUserMountDirectory(model.path) 65 | onTriggered: folderModel.places.removeItem(model.index) 66 | } 67 | } 68 | 69 | onClicked: { 70 | folderModel.goTo(model.path) 71 | root.pathClicked() 72 | } 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/app/qml/ui/ViewPopover.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import Ubuntu.Components 1.3 3 | import Ubuntu.Components.Popups 1.3 4 | 5 | import "../components" as Components 6 | 7 | Dialog { 8 | id: rootItem 9 | 10 | property var folderListModel 11 | 12 | __closeOnDismissAreaPress: true 13 | 14 | Component.onCompleted: { 15 | __foreground.itemSpacing = units.gu(0) 16 | } 17 | 18 | ListItem { 19 | ListItemLayout { 20 | anchors { left: parent.left; right: parent.right } 21 | anchors.leftMargin: units.gu(-2) 22 | anchors.rightMargin: units.gu(-2) 23 | 24 | subtitle.text: i18n.tr("Show Hidden Files") 25 | subtitle.textSize: Label.Medium 26 | 27 | Switch{ 28 | SlotsLayout.position: SlotsLayout.Last 29 | 30 | checked: globalSettings.showHidden 31 | onCheckedChanged: globalSettings.showHidden = checked 32 | } 33 | } 34 | } 35 | 36 | Components.HorizontalOptionSelector { 37 | subtitle: i18n.tr("View As") 38 | selectedIndex: globalSettings.viewMethod 39 | model: [ i18n.tr("List"), i18n.tr("Icons") ] 40 | onSelectedIndexChanged: globalSettings.viewMethod = selectedIndex 41 | } 42 | 43 | Components.HorizontalOptionSelector { 44 | subtitle: i18n.tr("Grid size") 45 | visible: globalSettings.viewMethod === 1 46 | selectedIndex: globalSettings.gridSize 47 | model: [ i18n.tr("S"), i18n.tr("M"), i18n.tr("L"), i18n.tr("XL") ] 48 | onSelectedIndexChanged: globalSettings.gridSize = selectedIndex 49 | } 50 | 51 | Components.HorizontalOptionSelector { 52 | subtitle: i18n.tr("List size") 53 | visible: globalSettings.viewMethod === 0 54 | selectedIndex: globalSettings.listSize 55 | model: [ i18n.tr("S"), i18n.tr("M"), i18n.tr("L"), i18n.tr("XL") ] 56 | onSelectedIndexChanged: globalSettings.listSize = selectedIndex 57 | } 58 | 59 | Components.HorizontalOptionSelector { 60 | subtitle: i18n.tr("Sort By") 61 | selectedIndex: globalSettings.sortBy 62 | model: [ i18n.tr("Name"), i18n.tr("Date"), i18n.tr("Size") ] 63 | onSelectedIndexChanged: globalSettings.sortBy = selectedIndex 64 | } 65 | 66 | Components.HorizontalOptionSelector { 67 | subtitle: i18n.tr("Sort Order") 68 | selectedIndex: globalSettings.sortOrder 69 | model: [ "A ➡ Z", "Z ➡ A" ] 70 | onSelectedIndexChanged: globalSettings.sortOrder = selectedIndex 71 | } 72 | 73 | Components.HorizontalOptionSelector { 74 | subtitle: i18n.tr("Theme") 75 | selectedIndex: globalSettings.darkTheme 76 | model: [ i18n.tr("Light"), i18n.tr("Dark") ] 77 | onSelectedIndexChanged: globalSettings.darkTheme = selectedIndex 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/app/qml/views/FolderIconView.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Authored by: Michael Spencer 17 | */ 18 | import QtQuick 2.4 19 | import Ubuntu.Components 1.3 20 | import Ubuntu.Components.Popups 1.3 21 | 22 | ScrollView { 23 | id: folderIconView 24 | 25 | property var folderListPage 26 | property var fileOperationDialog 27 | property var folderModel 28 | 29 | property alias footer: view.footer 30 | property alias header: view.header 31 | 32 | function calcCellwidth () { 33 | var s = 12 // default 34 | switch (globalSettings.gridSize) { 35 | case 0: s = 10 36 | break 37 | case 1: s = 12 38 | break 39 | case 2: s = 16 40 | break 41 | case 3: s = 22 42 | break 43 | } 44 | return folderListPage.width / ((folderListPage.width / units.gu(s)).toFixed(0)) 45 | } 46 | 47 | GridView { 48 | id: view 49 | anchors.fill: parent 50 | 51 | cellWidth: calcCellwidth() 52 | cellHeight: cellWidth + units.gu(2) 53 | 54 | model: folderModel.model 55 | delegate: FolderIconDelegate { 56 | id: delegate 57 | width: view.cellWidth 58 | height: view.cellHeight 59 | 60 | iconName: model.iconName 61 | title: model.fileName 62 | isSelected: model.isSelected 63 | path: model.filePath 64 | 65 | property var __delegateActions: FolderDelegateActions { 66 | folderListPage: folderIconView.folderListPage 67 | folderModel: folderIconView.folderModel 68 | fileOperationDialog: folderIconView.fileOperationDialog 69 | } 70 | 71 | onClicked: { 72 | if (mouse.button === Qt.RightButton) { 73 | delegate.pressAndHold(mouse) 74 | } else { 75 | __delegateActions.itemClicked(model) 76 | } 77 | } 78 | 79 | onPressAndHold: __delegateActions.listLongPress(model) 80 | } 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /src/app/qml/views/FolderListView.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Authored by: Arto Jalkanen 17 | */ 18 | import QtQuick 2.4 19 | import Ubuntu.Components 1.3 20 | import Ubuntu.Components.Popups 1.3 21 | 22 | import "../actions" as FMActions 23 | import "../components" 24 | 25 | ScrollView { 26 | id: folderListView 27 | 28 | property var folderListPage 29 | property var fileOperationDialog 30 | property var folderModel 31 | 32 | property alias footer: root.footer 33 | property alias header: root.header 34 | 35 | ListView { 36 | id: root 37 | anchors.fill: parent 38 | model: folderModel.model 39 | 40 | delegate: FolderListDelegate { 41 | id: delegate 42 | 43 | title: model.fileName 44 | subtitle: __delegateActions.itemDateAndSize(model) 45 | iconName: model.iconName 46 | showProgressionSlot: model.isBrowsable 47 | isSelected: model.isSelected 48 | path: model.filePath 49 | 50 | property var __delegateActions: FolderDelegateActions { 51 | folderListPage: folderListView.folderListPage 52 | folderModel: folderListView.folderModel 53 | fileOperationDialog: folderListView.fileOperationDialog 54 | } 55 | 56 | leadingActions: ListItemActions { 57 | // Children is an alias for 'actions' property, this way we don't get any warning about non-NOTIFYable props 58 | actions: __delegateActions.leadingActions.children 59 | } 60 | 61 | trailingActions: ListItemActions { 62 | // Children is an alias for 'actions' property, this way we don't get any warning about non-NOTIFYable props 63 | actions: __delegateActions.trailingActions.children 64 | } 65 | 66 | onClicked: __delegateActions.itemClicked(model) 67 | onPressAndHold: __delegateActions.listLongPress(model) 68 | } 69 | 70 | section.property: "isDir" 71 | section.delegate: SectionDivider { 72 | text: section == "true" ? i18n.tr("Directories") : i18n.tr("Files") 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Disable TagLib in folderlistmodel plugin 2 | ADD_DEFINITIONS(-DDO_NOT_USE_TAG_LIB) 3 | 4 | include(FindPkgConfig) 5 | find_package(Qt5Core) 6 | find_package(Qt5Qml) 7 | find_package(Qt5Quick) 8 | find_package(Qt5Widgets) 9 | 10 | add_subdirectory(folderlistmodel) 11 | add_subdirectory(placesmodel) 12 | add_subdirectory(pamauthentication) 13 | add_subdirectory(archives) 14 | -------------------------------------------------------------------------------- /src/plugin/archives/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${CMAKE_CURRENT_SOURCE_DIR} 3 | ) 4 | 5 | set(PLUGIN_DIR com/ubuntu/Archives) 6 | 7 | set(archives_SRCS 8 | archives.cpp 9 | archives.h 10 | archives_plugin.cpp 11 | archives_plugin.h 12 | ) 13 | 14 | add_library(Archives MODULE 15 | ${archives_SRCS} 16 | ) 17 | 18 | qt5_use_modules(Archives Gui Qml Quick Widgets) 19 | 20 | # Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator 21 | if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") 22 | add_custom_command(TARGET Archives POST_BUILD 23 | COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} 24 | COMMENT "Creating plugin directory layout in the build directory" 25 | COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} 26 | COMMENT "Copying the qmldir file to the build directory" 27 | COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} 28 | COMMENT "Copying the plugin binary to the build directory" 29 | ) 30 | endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") 31 | 32 | # Install plugin file 33 | install(TARGETS Archives DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR}) 34 | install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR}) 35 | 36 | -------------------------------------------------------------------------------- /src/plugin/archives/archives.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Author : Niklas Wenzel 17 | */ 18 | 19 | #ifndef ARCHIVES_H 20 | #define ARCHIVES_H 21 | 22 | #include 23 | #include 24 | 25 | class Archives : public QObject 26 | { 27 | Q_OBJECT 28 | 29 | Q_PROPERTY(bool extracting READ extracting NOTIFY extractingChanged) 30 | 31 | public: 32 | Q_INVOKABLE bool extract(const QString path, const QString destination); 33 | Q_INVOKABLE void cancelArchiveExtraction(); 34 | 35 | inline bool extracting() const 36 | { 37 | return _process ? _process->state() == QProcess::Running 38 | : false; 39 | } 40 | 41 | void extractZip(const QString path, const QString destination); 42 | void extractTar(const QString path, const QString destination); 43 | void extractGzipTar(const QString path, const QString destination); 44 | void extractBzipTar(const QString path, const QString destination); 45 | 46 | signals: 47 | void extractingChanged(); 48 | void finished(bool success, int errorCode); 49 | void killProcess(); 50 | 51 | private slots: 52 | void _onError(QProcess::ProcessError error); 53 | void _onFinished(int exitCode, QProcess::ExitStatus exitStatus); 54 | 55 | private: 56 | void extractArchive(const QString program, const QStringList arguments); 57 | 58 | QProcess *_process = nullptr; 59 | }; 60 | 61 | 62 | #endif // ARCHIVES_H 63 | -------------------------------------------------------------------------------- /src/plugin/archives/archives_plugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Author : Niklas Wenzel 17 | */ 18 | 19 | #include 20 | #include 21 | #include "archives_plugin.h" 22 | #include "archives.h" 23 | 24 | void BackendPlugin::registerTypes(const char *uri) 25 | { 26 | Q_ASSERT(uri == QLatin1String("com.ubuntu.Archives")); 27 | 28 | qmlRegisterType(uri, 0, 1, "Archives"); 29 | } 30 | 31 | void BackendPlugin::initializeEngine(QQmlEngine *engine, const char *uri) 32 | { 33 | QQmlExtensionPlugin::initializeEngine(engine, uri); 34 | } 35 | -------------------------------------------------------------------------------- /src/plugin/archives/archives_plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Author : Niklas Wenzel 17 | */ 18 | 19 | #ifndef ARCHIVES_PLUGIN_H 20 | #define ARCHIVES_PLUGIN_H 21 | 22 | #include 23 | #include 24 | 25 | class BackendPlugin : public QQmlExtensionPlugin 26 | { 27 | Q_OBJECT 28 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 29 | 30 | public: 31 | void registerTypes(const char *uri); 32 | void initializeEngine(QQmlEngine *engine, const char *uri); 33 | }; 34 | #endif // ARCHIVES_PLUGIN_H 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/plugin/archives/qmldir: -------------------------------------------------------------------------------- 1 | module com.ubuntu.Archives 2 | plugin Archives 3 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/README: -------------------------------------------------------------------------------- 1 | Building and installing 2 | ======================= 3 | 4 | qmake [available-defines] 5 | 6 | where available-debug-messages are: 7 | DEBUG_MESSAGES -> enable generic debug messages use: qmake "DEINES+=DEBUG_MESSAGES" 8 | DEBUG_EXT_FS_WATCHER -> enable External File System Watcher messages use: qmake "DEINES+=DEBUG_EXT_FS_WATCHER" 9 | DEBUG_REMOVE -> enable message about every remove use: qmake "DEINES+=DEBUG_REMOVE" 10 | DO_NOT_USE_TAG_LIB -> disable using TAGLIB and getting metada use: qmake "DEINES+=DO_NOT_USE_TAG_LIB" 11 | 12 | make 13 | sudo make install 14 | 15 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/cleanurl.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: cleanurl.cpp 19 | * Date: 04/02/2015 20 | */ 21 | 22 | #include "cleanurl.h" 23 | 24 | #include 25 | 26 | CleanUrl::CleanUrl(const QString &urlPath) : m_user(0), m_password(0) 27 | { 28 | QUrl url(urlPath); 29 | 30 | if (url.isValid()) { 31 | QString user = url.userName(); 32 | 33 | if (!user.isEmpty()) { 34 | m_user = new QString(user); 35 | m_password = new QString(url.password()); 36 | 37 | url.setPassword(QLatin1String(0)); 38 | url.setUserName(QLatin1String(0)); 39 | } 40 | 41 | m_url = url.toString(); 42 | 43 | } else { 44 | m_url = urlPath; 45 | } 46 | } 47 | 48 | 49 | CleanUrl::~CleanUrl() 50 | { 51 | if (m_user) { 52 | delete m_user; 53 | } 54 | 55 | if (m_password) { 56 | delete m_password; 57 | } 58 | } 59 | 60 | 61 | bool CleanUrl::hasAuthenticationData() const 62 | { 63 | return m_user ? true : false; 64 | } 65 | 66 | QString CleanUrl::user() const 67 | { 68 | return m_user ? *m_user : QString(); 69 | } 70 | 71 | QString CleanUrl::password() const 72 | { 73 | return m_password ? *m_password : QString(); 74 | } 75 | 76 | QString CleanUrl::cleanUrl() const 77 | { 78 | return m_url; 79 | } 80 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/cleanurl.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: cleanurl.h 19 | * Date: 04/02/2015 20 | */ 21 | 22 | #ifndef CLEANURL_H 23 | #define CLEANURL_H 24 | 25 | #include 26 | 27 | /*! 28 | * \brief The CleanUrl class 29 | * 30 | * Just returns a URL without user/password if exists 31 | */ 32 | class CleanUrl 33 | { 34 | public: 35 | CleanUrl(const QString &urlPath); 36 | ~CleanUrl(); 37 | 38 | bool hasAuthenticationData() const; 39 | QString cleanUrl() const; 40 | QString user() const; 41 | QString password() const; 42 | 43 | private: 44 | QString m_url; //!< keeps the url without user/password 45 | QString *m_user; 46 | QString *m_password; 47 | }; 48 | 49 | #endif // CLEANURL_H 50 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/diritemabstractlistmodel.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2014 Canonical Ltd. 4 | * Copyright 2014 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: diritemabstractlistmodel.h 19 | * Date: 30/01/2014 20 | */ 21 | 22 | #ifndef DIRITEMABSTRACTLISTMODEL_H 23 | #define DIRITEMABSTRACTLISTMODEL_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | 30 | class DirItemInfo; 31 | class DirItemModel; 32 | 33 | class DirItemAbstractListModel : public QAbstractListModel 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | virtual int getIndex(const QString &name) = 0; 39 | virtual void notifyItemChanged(int index) = 0; 40 | 41 | protected: 42 | explicit DirItemAbstractListModel(QObject *parent = 0) : 43 | QAbstractListModel(parent) 44 | { } 45 | }; 46 | 47 | #endif // DIRITEMABSTRACTLISTMODEL_H 48 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/disk/disklocationitemdir.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: disklocationitemdir.cpp 19 | * Date: 16/05/2015 20 | */ 21 | 22 | #include "disklocationitemdir.h" 23 | #include 24 | 25 | DiskLocationItemDir::DiskLocationItemDir(const QString &dir) : 26 | LocationItemDir(dir) 27 | , m_qtQDir(new QDir()) 28 | { 29 | if (!dir.isNull() && !dir.isEmpty()) { 30 | m_qtQDir->setPath(dir); 31 | } 32 | } 33 | 34 | DiskLocationItemDir::~DiskLocationItemDir() 35 | { 36 | delete m_qtQDir; 37 | } 38 | 39 | bool DiskLocationItemDir::exists() const 40 | { 41 | return m_qtQDir->exists(); 42 | } 43 | 44 | bool DiskLocationItemDir::mkdir(const QString &dir) const 45 | { 46 | return m_qtQDir->mkdir(dir); 47 | } 48 | 49 | bool DiskLocationItemDir::mkpath(const QString &dir) const 50 | { 51 | return m_qtQDir->mkpath(dir); 52 | } 53 | 54 | bool DiskLocationItemDir::rmdir(const QString &dir) const 55 | { 56 | return m_qtQDir->rmdir(dir); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/disk/disklocationitemdir.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: disklocationitemdir.h 19 | * Date: 16/05/2015 20 | */ 21 | 22 | #ifndef DISKLOCATIONITEMDIR_H 23 | #define DISKLOCATIONITEMDIR_H 24 | 25 | #include "locationitemdir.h" 26 | 27 | class QDir; 28 | 29 | class DiskLocationItemDir : public LocationItemDir 30 | { 31 | public: 32 | DiskLocationItemDir(const QString &dir = QLatin1String(0) ); 33 | ~DiskLocationItemDir(); 34 | 35 | public: 36 | virtual bool exists() const; 37 | virtual bool mkdir(const QString &dir) const; 38 | virtual bool mkpath(const QString &dir) const; 39 | virtual bool rmdir(const QString &dir) const; 40 | private: 41 | QDir *m_qtQDir; 42 | 43 | }; 44 | 45 | #endif // DISKLOCATIONITEMDIR_H 46 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/disk/disklocationitemdiriterator.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: disklocationitemdiriterator.cpp 19 | * Date: 29/03/2015 20 | */ 21 | 22 | #include "disklocationitemdiriterator.h" 23 | 24 | #include 25 | 26 | DiskLocationItemDirIterator::DiskLocationItemDirIterator(const QString &path, const QStringList &nameFilters, 27 | QDir::Filters filters, QDirIterator::IteratorFlags flags) 28 | : LocationItemDirIterator(path, nameFilters, filters, flags) 29 | , m_qtDirIterator(new QDirIterator(path, nameFilters, filters, flags)) 30 | { 31 | 32 | } 33 | 34 | DiskLocationItemDirIterator::DiskLocationItemDirIterator(const QString &path, QDir::Filters filters, QDirIterator::IteratorFlags flags) 35 | : LocationItemDirIterator(path, filters, flags) 36 | , m_qtDirIterator(new QDirIterator(path, filters, flags)) 37 | { 38 | 39 | } 40 | 41 | DiskLocationItemDirIterator::DiskLocationItemDirIterator(const QString &path, QDirIterator::IteratorFlags flags) 42 | : LocationItemDirIterator(path, flags) 43 | , m_qtDirIterator(new QDirIterator(path, flags)) 44 | { 45 | 46 | } 47 | 48 | DiskLocationItemDirIterator::~DiskLocationItemDirIterator() 49 | { 50 | delete m_qtDirIterator; 51 | } 52 | 53 | DirItemInfo DiskLocationItemDirIterator::fileInfo() const 54 | { 55 | DirItemInfo itemInfo (m_qtDirIterator->fileInfo()); 56 | return itemInfo; 57 | } 58 | 59 | QString DiskLocationItemDirIterator::fileName() const 60 | { 61 | return m_qtDirIterator->fileName(); 62 | } 63 | 64 | QString DiskLocationItemDirIterator::filePath() const 65 | { 66 | return m_qtDirIterator->filePath(); 67 | } 68 | 69 | bool DiskLocationItemDirIterator::hasNext() const 70 | { 71 | return m_qtDirIterator->hasNext(); 72 | } 73 | 74 | QString DiskLocationItemDirIterator::next() 75 | { 76 | return m_qtDirIterator->next(); 77 | } 78 | 79 | QString DiskLocationItemDirIterator::path() const 80 | { 81 | return m_qtDirIterator->path(); 82 | } 83 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/disk/disklocationitemdiriterator.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: disklocationitemdiriterator.h 19 | * Date: 29/03/2015 20 | */ 21 | 22 | #ifndef DISKLOCATIONITEMDIRITERATOR_H 23 | #define DISKLOCATIONITEMDIRITERATOR_H 24 | 25 | #include "locationitemdiriterator.h" 26 | 27 | class QDirIterator; 28 | 29 | class DiskLocationItemDirIterator : public LocationItemDirIterator 30 | { 31 | public: 32 | explicit DiskLocationItemDirIterator(QObject *parent = 0); 33 | ~DiskLocationItemDirIterator(); 34 | 35 | public: 36 | virtual DirItemInfo fileInfo() const; 37 | virtual QString fileName() const; 38 | virtual QString filePath() const; 39 | virtual bool hasNext() const; 40 | virtual QString next(); 41 | virtual QString path() const; 42 | 43 | public: 44 | DiskLocationItemDirIterator(const QString &path, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags); 45 | DiskLocationItemDirIterator(const QString &path, QDir::Filters filters, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags); 46 | DiskLocationItemDirIterator(const QString &path, const QStringList &nameFilters, QDir::Filters filters = QDir::NoFilter, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags); 47 | 48 | private: 49 | QDirIterator *m_qtDirIterator; 50 | 51 | }; 52 | 53 | #endif // DISKLOCATIONITEMDIRITERATOR_H 54 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/disk/disklocationitemfile.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: disklocationitemfile.h 19 | * Date: 20/04/2015 20 | */ 21 | 22 | #ifndef DISKLOCATIONITEMFILE_H 23 | #define DISKLOCATIONITEMFILE_H 24 | 25 | #include "locationitemfile.h" 26 | 27 | class DiskLocationItemFile : public LocationItemFile 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit DiskLocationItemFile(QObject *parent); 32 | explicit DiskLocationItemFile(const QString &name, QObject *parent); 33 | ~DiskLocationItemFile(); 34 | 35 | public: 36 | virtual QString fileName() const; 37 | virtual bool rename(const QString &newName); 38 | virtual bool rename(const QString &oldname, const QString &newName); 39 | virtual bool remove(); 40 | virtual bool remove(const QString &name); 41 | virtual bool link(const QString &linkName); 42 | virtual bool open(QFile::OpenMode mode) ; 43 | virtual qint64 read(char *, qint64); 44 | virtual qint64 write(const char *, qint64); 45 | virtual void close(); 46 | virtual bool atEnd() const; 47 | virtual qint64 size() const; 48 | virtual bool isOpen() const; 49 | virtual bool setPermissions(const QString &filename, QFile::Permissions perm); 50 | virtual bool setPermissions(QFile::Permissions perm); 51 | virtual QFile::Permissions permissions() const; 52 | 53 | private: 54 | QFile *m_qtFile; 55 | }; 56 | 57 | #endif // DISKLOCATIONITEMFILE_H 58 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/filecompare.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2013 Canonical Ltd. 4 | * Copyright 2013 Carlos J Mazieri 5 | * 6 | * You may use this file under the terms of the BSD license as follows: 7 | * 8 | * "Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are 10 | * met: 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Nemo Mobile nor the names of its contributors 18 | * may be used to endorse or promote products derived from this 19 | * software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 32 | * 33 | * File: filecompare.h 34 | * Date: 6/25/2013 35 | */ 36 | 37 | #ifndef FILECOMPARE_H 38 | #define FILECOMPARE_H 39 | 40 | class DirItemInfo; 41 | 42 | typedef bool (*CompareFunction)(const DirItemInfo &a, const DirItemInfo &b); 43 | 44 | bool fileCompareExists(const DirItemInfo &a, const DirItemInfo &b); 45 | bool fileCompareAscending(const DirItemInfo &a, const DirItemInfo &b); 46 | bool fileCompareDescending(const DirItemInfo &a, const DirItemInfo &b); 47 | 48 | bool dateCompareDescending(const DirItemInfo &a, const DirItemInfo &b); 49 | bool dateCompareAscending(const DirItemInfo &a, const DirItemInfo &b); 50 | 51 | bool sizeCompareDescending(const DirItemInfo &a, const DirItemInfo &b); 52 | bool sizeCompareAscending(const DirItemInfo &a, const DirItemInfo &b); 53 | 54 | #endif // FILECOMPARE_H 55 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/fmutil.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2014 Canonical Ltd. 4 | * Copyright 2014 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: fmutil.h 19 | * Date: 29/01/2014 20 | */ 21 | 22 | #ifndef FMUTIL_H 23 | #define FMUTIL_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | /*! 30 | * \brief The FMUtil class provides some utitlities 31 | */ 32 | class FMUtil 33 | { 34 | public: 35 | static void setThemeName(); 36 | static inline bool hasTriedThemeName() 37 | { 38 | return m_triedThemeName; 39 | } 40 | 41 | private: 42 | FMUtil(); 43 | static bool testThemeName(const QString &themeName); 44 | 45 | private: 46 | static bool m_triedThemeName; 47 | }; 48 | 49 | #endif // FMUTIL_H 50 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/folderlistmodel.pro: -------------------------------------------------------------------------------- 1 | TARGET = nemofolderlistmodel 2 | 3 | PLUGIN_IMPORT_PATH = org/nemomobile/folderlistmodel 4 | 5 | #core: sources + headers, separated here to use in regression test project 6 | include (folderlistmodel.pri) 7 | 8 | # Input 9 | SOURCES += plugin.cpp 10 | HEADERS += plugin.h 11 | 12 | ## QApplication::clipboard() needs gui 13 | QT += gui 14 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 15 | 16 | exists(../plugin.pri) { 17 | include(../plugin.pri) 18 | } 19 | else { 20 | TEMPLATE = lib 21 | CONFIG += qt plugin hide_symbols 22 | greaterThan(QT_MAJOR_VERSION, 4) { 23 | QT += qml quick 24 | } 25 | else { 26 | QT += declarative 27 | } 28 | target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH 29 | INSTALLS += target 30 | qmldir.files += $$PWD/qmldir 31 | qmldir.path += $$[QT_INSTALL_QML]/$$$$PLUGIN_IMPORT_PATH 32 | INSTALLS += qmldir 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/imageprovider.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/ 5 | ** 6 | ** This file is part of the demonstration applications of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor 21 | ** the names of its contributors may be used to endorse or promote 22 | ** products derived from this software without specific prior written 23 | ** permission. 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef IMAGEPROVIDER_H 42 | #define IMAGEPROVIDER_H 43 | 44 | #include 45 | 46 | #include 47 | #include 48 | 49 | 50 | class CoverArtImageProvider : public QQuickImageProvider 51 | { 52 | public: 53 | explicit CoverArtImageProvider(); 54 | 55 | QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize); 56 | 57 | }; 58 | 59 | class CoverArtFullImageProvider : public QQuickImageProvider 60 | { 61 | public: 62 | explicit CoverArtFullImageProvider(); 63 | 64 | QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize); 65 | 66 | }; 67 | 68 | 69 | #endif // IMAGEPROVIDER_H 70 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/iorequestworker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Robin Burchell 3 | * 4 | * You may use this file under the terms of the BSD license as follows: 5 | * 6 | * "Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Nemo Mobile nor the names of its contributors 16 | * may be used to endorse or promote products derived from this 17 | * software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 30 | */ 31 | 32 | #ifndef IOREQUESTWORKER_H 33 | #define IOREQUESTWORKER_H 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include "iorequest.h" 41 | 42 | class IORequestWorker : public QThread 43 | { 44 | Q_OBJECT 45 | public: 46 | explicit IORequestWorker(); 47 | 48 | void addRequest(IORequest *request); 49 | 50 | void run(); 51 | 52 | void exit(); 53 | 54 | private: 55 | QMutex mMutex; 56 | QWaitCondition mWaitCondition; 57 | QList mRequests; 58 | bool mTimeToQuit; 59 | }; 60 | 61 | #endif // IOREQUESTWORKER_H 62 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/ioworkerthread.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Robin Burchell 3 | * 4 | * You may use this file under the terms of the BSD license as follows: 5 | * 6 | * "Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Nemo Mobile nor the names of its contributors 16 | * may be used to endorse or promote products derived from this 17 | * software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 30 | */ 31 | 32 | #include "ioworkerthread.h" 33 | 34 | 35 | /*! 36 | Hosts a thread, lives on the main thread. 37 | 38 | Responsible for relaying interaction between the main thread and an IOWorkerThread. 39 | */ 40 | IOWorkerThread::IOWorkerThread(QObject *parent) : 41 | QObject(parent) 42 | { 43 | mWorker.start(QThread::IdlePriority); 44 | } 45 | 46 | /*! 47 | Destroys an IOWorkerThread instance. 48 | */ 49 | IOWorkerThread::~IOWorkerThread() 50 | { 51 | mWorker.exit(); 52 | mWorker.wait(); 53 | } 54 | 55 | /*! 56 | Attempts an asynchronous attempt to start a \a request. 57 | 58 | If the request may be run, it is queued, and true is returned, otherwise, false. 59 | */ 60 | bool IOWorkerThread::addRequest(IORequest *request) 61 | { 62 | mWorker.addRequest(request); 63 | return true; 64 | } 65 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/ioworkerthread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Robin Burchell 3 | * 4 | * You may use this file under the terms of the BSD license as follows: 5 | * 6 | * "Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Nemo Mobile nor the names of its contributors 16 | * may be used to endorse or promote products derived from this 17 | * software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 30 | */ 31 | 32 | #ifndef IOWORKERTHREAD_H 33 | #define IOWORKERTHREAD_H 34 | 35 | #include 36 | #include 37 | 38 | #include "iorequestworker.h" 39 | 40 | class IOWorkerThread : public QObject 41 | { 42 | Q_OBJECT 43 | public: 44 | explicit IOWorkerThread(QObject *parent = 0); 45 | virtual ~IOWorkerThread(); 46 | bool addRequest(IORequest *request); 47 | 48 | private: 49 | IORequestWorker mWorker; 50 | }; 51 | 52 | #endif // IOWORKERTHREAD_H 53 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/locationitemdir.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: locationitemdir.cpp 19 | * Date: 16/05/2015 20 | */ 21 | 22 | #include "locationitemdir.h" 23 | #include 24 | 25 | LocationItemDir::LocationItemDir(const QString &dir) 26 | { 27 | Q_UNUSED(dir); 28 | } 29 | 30 | 31 | LocationItemDir::~LocationItemDir() 32 | { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/locationitemdir.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: locationitemdir.h 19 | * Date: 16/05/2015 20 | */ 21 | 22 | #ifndef LOCATIONITEMDIR_H 23 | #define LOCATIONITEMDIR_H 24 | 25 | #include 26 | 27 | class LocationItemDir 28 | { 29 | public: 30 | virtual ~LocationItemDir(); 31 | public: 32 | virtual bool exists() const = 0; 33 | virtual bool mkdir(const QString &dir) const = 0; 34 | virtual bool mkpath(const QString &dir) const = 0; 35 | virtual bool rmdir(const QString &dir) const = 0; 36 | protected: 37 | LocationItemDir (); 38 | LocationItemDir (const QString &dir = QLatin1String(0)); 39 | }; 40 | 41 | #endif // LOCATIONITEMDIR_H 42 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/locationitemfile.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: locationitemfile.h 19 | * Date: 20/04/2015 20 | */ 21 | 22 | #ifndef LOCATIONITEMFILE_H 23 | #define LOCATIONITEMFILE_H 24 | 25 | #include 26 | #include 27 | 28 | 29 | 30 | /*! 31 | * \brief The LocationItemFile class is an abstract class similar to Qt QFile 32 | * 33 | * It will be used in Actions like copy/paste 34 | */ 35 | class LocationItemFile : public QObject 36 | { 37 | Q_OBJECT 38 | protected: 39 | explicit LocationItemFile(QObject *parent = 0); 40 | explicit LocationItemFile(const QString &name, QObject *parent = 0); 41 | public: 42 | virtual ~LocationItemFile(); 43 | public: 44 | virtual QString fileName() const = 0; 45 | virtual bool rename(const QString &newName) = 0; 46 | virtual bool rename(const QString &oldname, const QString &newName) = 0; 47 | virtual bool remove() = 0; 48 | virtual bool remove(const QString &name) = 0; 49 | virtual bool link(const QString &linkName) = 0; 50 | virtual bool open(QFile::OpenMode mode) = 0 ; 51 | virtual qint64 read(char *, qint64) = 0; 52 | virtual qint64 write(const char *, qint64) = 0; 53 | virtual void close() = 0; 54 | virtual bool atEnd() const = 0; 55 | virtual qint64 size() const = 0; 56 | virtual bool isOpen() const = 0; 57 | virtual bool setPermissions(const QString &filename, QFile::Permissions perm) = 0; 58 | virtual bool setPermissions(QFile::Permissions perm) = 0; 59 | virtual QFile::Permissions permissions() const = 0; 60 | public: //static functions 61 | static mode_t getUmask(); //return the current umask 62 | static mode_t getUmaskCreationMode(mode_t mode); // mode & ~umask; 63 | static mode_t getUmaskFilesCreation(); // 0666 & ~umask; 64 | static mode_t getUmaskDirsCreation(); // 0777 & ~umask; 65 | static mode_t unixPermissions(QFile::Permissions); 66 | signals: 67 | 68 | public slots: 69 | 70 | }; 71 | 72 | #endif // LOCATIONITEMFILE_H 73 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/locationurl.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2014 Canonical Ltd. 4 | * Copyright 2014 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: locationurl.cpp 19 | * Date: 11/03/2014 20 | */ 21 | 22 | #include "locationurl.h" 23 | #include 24 | 25 | const QString LocationUrl::UrlIndicator("://"); 26 | 27 | const QString LocationUrl::TrashRootURL("trash:///"); 28 | const QString LocationUrl::DiskRootURL("file:///"); 29 | const QString LocationUrl::SmbURL("smb://"); 30 | const QString LocationUrl::CifsURL("cifs://"); 31 | #if 0 32 | QString LocationURL::FishURL("fish:///"); 33 | #endif 34 | // keep this list ordered 35 | const QStringList LocationUrl::m_supportedURLs = QStringList() << LocationUrl::CifsURL 36 | << LocationUrl::DiskRootURL 37 | << LocationUrl::SmbURL 38 | << LocationUrl::TrashRootURL 39 | ; 40 | 41 | LocationUrl::LocationUrl() 42 | { 43 | 44 | } 45 | 46 | 47 | const QStringList &LocationUrl::supportedURLs() 48 | { 49 | return m_supportedURLs; 50 | } 51 | 52 | 53 | bool LocationUrl::isSupportedUrl(const QUrl &url) 54 | { 55 | bool ret = url.isValid() && url.isLocalFile(); // local files does not need to check 56 | if (!ret && !url.scheme().isEmpty()) { 57 | int counter = m_supportedURLs.count(); 58 | while (!ret && counter--) { 59 | ret = m_supportedURLs.at(counter).startsWith(url.scheme(), Qt::CaseSensitive); 60 | } 61 | } 62 | return ret; 63 | } 64 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/locationurl.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2014 Canonical Ltd. 4 | * Copyright 2014 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: locationurl.h 19 | * Date: 11/03/2014 20 | */ 21 | 22 | #ifndef LOCATIONURL_H 23 | #define LOCATIONURL_H 24 | 25 | #include 26 | class QUrl; 27 | 28 | class LocationUrl 29 | { 30 | public: 31 | static const QString UrlIndicator; 32 | static const QString DiskRootURL; 33 | static const QString TrashRootURL; 34 | static const QString SmbURL; 35 | static const QString CifsURL; 36 | #if 0 37 | static const QString FishURL; 38 | #endif 39 | /*! 40 | * \brief supportedURLs() Tells which URLs are supported by file manager 41 | * 42 | * It may be useful for Clipboard handling 43 | * 44 | * \return URLs list 45 | */ 46 | static const QStringList &supportedURLs(); 47 | static bool isSupportedUrl(const QUrl &url); 48 | private: 49 | LocationUrl(); 50 | static const QStringList m_supportedURLs; 51 | }; 52 | 53 | #endif // LOCATIONURL_H 54 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/net/netutil.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2014 Canonical Ltd. 4 | * Copyright 2014 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: netutil.h 19 | * Date: 29/11/2014 20 | */ 21 | 22 | #ifndef NETUTIL_H 23 | #define NETUTIL_H 24 | 25 | #include 26 | 27 | class NetUtil 28 | { 29 | private: 30 | NetUtil(); 31 | 32 | public: 33 | static QString normalizeHostName(const QString &name); 34 | static QString urlConvertHostnameToIP(const QString &url); 35 | }; 36 | 37 | #endif // NETUTIL_H 38 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/networklistworker.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: networklistworker.h 19 | * Date: 06/12/2015 20 | */ 21 | 22 | #ifndef NETWORKLISTWORKER_H 23 | #define NETWORKLISTWORKER_H 24 | 25 | #include "iorequestworker.h" 26 | 27 | class LocationItemDirIterator; 28 | class DirItemInfo; 29 | 30 | /*! 31 | * \brief The NetworkListWorker class intends to be a generic Network directory loader. 32 | *. 33 | * It trusts on \ref LocationItemDirIterator and \ref DirItemInfo classes 34 | * 35 | * The LocationItemDirIterator::load() must bring the list of items. 36 | */ 37 | class NetworkListWorker : public DirListWorker 38 | { 39 | Q_OBJECT 40 | public: 41 | NetworkListWorker(LocationItemDirIterator *dirIterator, 42 | DirItemInfo *mainItemInfo, 43 | const DirItemInfo *parentItemInfo = 0); 44 | ~NetworkListWorker(); 45 | protected: 46 | virtual DirItemInfoList getNetworkContent(); 47 | void setSmbItemAttributes(); 48 | protected: 49 | LocationItemDirIterator *m_dirIterator; 50 | DirItemInfo *m_mainItemInfo; //takes ownership from mainItemInfo 51 | DirItemInfo 52 | *m_parentItemInfo; //create its own instance by doing a copy from parentItemInfo 53 | }; 54 | 55 | #endif // NETWORKLISTWORKER_H 56 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/networklocation.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: networklocation.cpp 19 | * Date: 08/12/2015 20 | */ 21 | 22 | #include "networklocation.h" 23 | #include "networklistworker.h" 24 | #include "locationitemdiriterator.h" 25 | #include "diriteminfo.h" 26 | 27 | NetworkLocation::NetworkLocation(int type, QObject *parent): Location(type, parent) 28 | { 29 | } 30 | 31 | 32 | 33 | DirListWorker *NetworkLocation::newListWorker(const QString &urlPath, QDir::Filters filter, 34 | const bool isRecursive) 35 | { 36 | QDirIterator::IteratorFlags flags = isRecursive ? QDirIterator::Subdirectories : 37 | QDirIterator::NoIteratorFlags; 38 | 39 | LocationItemDirIterator *dirIterator = newDirIterator(urlPath, filter, flags, 40 | LocationItemDirIterator::LoadLater); 41 | DirItemInfo *baseitemInfo = newItemInfo(QLatin1String(0)); 42 | // the NetworkListWorker object takes ownership of baseitemInfo and also creates its own copy of m_info 43 | return new NetworkListWorker(dirIterator, baseitemInfo, m_info); 44 | } 45 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/plugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Robin Burchell 3 | * 4 | * You may use this file under the terms of the BSD license as follows: 5 | * 6 | * "Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * * Neither the name of Nemo Mobile nor the names of its contributors 16 | * may be used to endorse or promote products derived from this 17 | * software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 30 | */ 31 | 32 | #include "plugin.h" 33 | 34 | NemoFolderListModelPlugin::NemoFolderListModelPlugin() { } 35 | 36 | NemoFolderListModelPlugin::~NemoFolderListModelPlugin() { } 37 | 38 | void NemoFolderListModelPlugin::initializeEngine(QmlEngine *engine, const char *uri) 39 | { 40 | Q_ASSERT(uri == QLatin1String(PLUGIN_URI)); 41 | 42 | #ifndef DO_NOT_USE_TAG_LIB 43 | engine->addImageProvider(QLatin1String("cover-art"), new CoverArtImageProvider); 44 | engine->addImageProvider(QLatin1String("cover-art-full"), new CoverArtFullImageProvider); 45 | #endif //DO_NOT_USE_TAG_LIB 46 | 47 | Q_UNUSED(uri); 48 | Q_UNUSED(engine); 49 | } 50 | 51 | void NemoFolderListModelPlugin::registerTypes(const char *uri) 52 | { 53 | Q_ASSERT(uri == QLatin1String(PLUGIN_URI)); 54 | DirModel::registerMetaTypes(); 55 | qmlRegisterType(uri, 1, 0, "FolderListSelection"); 56 | qmlRegisterType(uri, 1, 0, "FolderListModel"); 57 | qmlRegisterType(uri, 1, 0, "FolderListSmbUserShare"); 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/qmldir: -------------------------------------------------------------------------------- 1 | module org.nemomobile.folderlistmodel 2 | plugin nemofolderlistmodel 3 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/qsambaclient/qsambaclient.pri: -------------------------------------------------------------------------------- 1 | 2 | SOURCES += $$PWD/src/smbutil.cpp \ 3 | $$PWD/src/smbusershare.cpp \ 4 | $$PWD/src/smbiteminfo.cpp \ 5 | $$PWD/src/smbplaces.cpp \ 6 | $$PWD/src/smbobject.cpp \ 7 | $$PWD/src/smblocationdiriterator.cpp \ 8 | $$PWD/src/smblocationitemfile.cpp \ 9 | $$PWD/src/smblocationitemdir.cpp 10 | 11 | 12 | HEADERS += $$PWD/src/smbutil.h \ 13 | $$PWD/src/smbusershare.h \ 14 | $$PWD/src/smbiteminfo.h \ 15 | $$PWD/src/smbplaces.h \ 16 | $$PWD/src/smbobject.h \ 17 | $$PWD/src/smblocationdiriterator.h \ 18 | $$PWD/src/smblocationitemfile.h \ 19 | $$PWD/src/smblocationitemdir.h 20 | 21 | 22 | QT *= core network 23 | 24 | CONFIG *= link_pkgconfig 25 | PKGCONFIG *= smbclient 26 | 27 | DEFINES *= _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64 28 | 29 | INCLUDEPATH += $$PWD/src 30 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/qsambaclient/qsambaclient_test.pro: -------------------------------------------------------------------------------- 1 | 2 | TEMPLATE = app 3 | CONFIG += console 4 | CONFIG -= app_bundle 5 | 6 | DEFINES += REGRESSION_TEST_QSAMBACLIENT 7 | 8 | include (qsambaclient.pri) 9 | 10 | include(test/testsuite.pri) 11 | 12 | include (ubuntuFM/ubuntuFM_dependencies.pri) 13 | 14 | ##main 15 | SOURCES += $$PWD/test/main_testqsambaclient.cpp 16 | 17 | OTHER_FILES += \ 18 | TODO.txt 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/qsambaclient/src/smbiteminfo.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2014 Canonical Ltd. 4 | * Copyright 2014 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: smbiteminfo.h 19 | * Date: 08/12/2014 20 | */ 21 | 22 | #ifndef SMBITEMINFO_H 23 | #define SMBITEMINFO_H 24 | 25 | #include "urliteminfo.h" 26 | #include "smbobject.h" 27 | 28 | class QUrl; 29 | 30 | class SmbItemInfo : public UrlItemInfo, public SmbObject 31 | { 32 | public: 33 | /*! 34 | * \brief SmbItemInfo 35 | * \param urlPath a url 36 | * \param smb an instance of \ref SmbUtil that has an authentication callback already set 37 | */ 38 | SmbItemInfo(const QString& urlPath, Const_SmbUtil_Ptr smb = 0); 39 | SmbItemInfo(); 40 | ~SmbItemInfo(); 41 | 42 | public: 43 | QString sharePath() const; 44 | virtual void setFile(const QString &dir, const QString & file); 45 | virtual void setFile(const QString &smb_path); 46 | 47 | protected: 48 | void setInfo(const QString &smb_path); 49 | }; 50 | 51 | #endif // SMBITEMINFO_H 52 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationdiriterator.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: smblocationdiriterator.h 19 | * Date: 10/01/2015 20 | */ 21 | 22 | #ifndef SMBLOCATIONDIRITERATOR_H 23 | #define SMBLOCATIONDIRITERATOR_H 24 | 25 | #include "locationitemdiriterator.h" 26 | #include "smbobject.h" 27 | 28 | class SmbLocationDirIterator: public LocationItemDirIterator, public SmbObject 29 | { 30 | public: 31 | ~SmbLocationDirIterator(); 32 | public: 33 | virtual DirItemInfo fileInfo() const; 34 | virtual QString fileName() const; 35 | virtual QString filePath() const; 36 | virtual bool hasNext() const; 37 | virtual QString next() ; 38 | virtual void load(); 39 | public: 40 | SmbLocationDirIterator(const QString & path, 41 | QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags, 42 | Const_SmbUtil_Ptr smb = 0, 43 | LocationItemDirIterator::LoadMode loadmode = LocationItemDirIterator::LoadOnConstructor); 44 | 45 | SmbLocationDirIterator(const QString & path, QDir::Filters filters, 46 | QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags, 47 | Const_SmbUtil_Ptr smb = 0, 48 | LocationItemDirIterator::LoadMode loadmode = LocationItemDirIterator::LoadOnConstructor); 49 | 50 | SmbLocationDirIterator(const QString & path, const QStringList & nameFilters, 51 | QDir::Filters filters = QDir::NoFilter, 52 | QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags, 53 | Const_SmbUtil_Ptr smb = 0, 54 | LocationItemDirIterator::LoadMode loadmode = LocationItemDirIterator::LoadOnConstructor); 55 | private: 56 | QStringList m_urlItems; 57 | int m_curItem; 58 | }; 59 | 60 | #endif // SMBLOCATIONDIRITERATOR_H 61 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemdir.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: smblocationitemdir.h 19 | * Date: 16/05/2015 20 | */ 21 | 22 | #ifndef SMBLOCATIONITEMDIR_H 23 | #define SMBLOCATIONITEMDIR_H 24 | 25 | #include "locationitemdir.h" 26 | #include "smbobject.h" 27 | 28 | class SmbLocationItemDir : public LocationItemDir, public SmbObject 29 | { 30 | public: 31 | SmbLocationItemDir(const QString& dir = QLatin1String(0), Const_SmbUtil_Ptr smb = 0 ); 32 | ~SmbLocationItemDir(); 33 | public: 34 | virtual bool exists() const; 35 | virtual bool mkdir(const QString& dir) const; 36 | virtual bool mkpath(const QString& dir) const; 37 | virtual bool rmdir(const QString& dir) const; 38 | private: 39 | QString makeAbsoluteUrl(const QString& dir) const; 40 | }; 41 | 42 | #endif // SMBLOCATIONITEMDIR_H 43 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: smblocationitemfile.h 19 | * Date: 20/04/2015 20 | */ 21 | 22 | #ifndef SMBLOCATIONITEMFILE_H 23 | #define SMBLOCATIONITEMFILE_H 24 | 25 | #include "locationitemfile.h" 26 | #include "smbobject.h" 27 | #include "smbutil.h" 28 | 29 | class SmbItemInfo; 30 | 31 | 32 | /*! 33 | * \brief The SmbLocationItemFile class is similar to Qt QFile 34 | * 35 | */ 36 | class SmbLocationItemFile : public LocationItemFile, public SmbObject 37 | { 38 | Q_OBJECT 39 | public: 40 | explicit SmbLocationItemFile(QObject *parent = 0, Const_SmbUtil_Ptr smb = 0); 41 | explicit SmbLocationItemFile(const QString& name, QObject *parent = 0, Const_SmbUtil_Ptr smb = 0); 42 | ~SmbLocationItemFile(); 43 | public: 44 | virtual QString fileName() const; 45 | virtual bool rename(const QString& newName); 46 | virtual bool rename(const QString& oldname, const QString& newName); 47 | virtual bool remove(); 48 | virtual bool remove(const QString& name); 49 | virtual bool link(const QString& linkName); 50 | virtual bool open(QFile::OpenMode mode) ; 51 | virtual qint64 read(char*, qint64); 52 | virtual qint64 write(const char *, qint64); 53 | virtual void close(); 54 | virtual bool atEnd() const; 55 | virtual qint64 size() const; 56 | virtual bool isOpen() const; 57 | virtual bool setPermissions(const QString& filename, QFile::Permissions perm); 58 | virtual bool setPermissions(QFile::Permissions perm); 59 | virtual QFile::Permissions permissions() const; 60 | private: 61 | bool private_remove(const QString& smb_path); 62 | void createContext(); // destroys the context if exists 63 | void createContextIfNotExists(); // creates only if there is no context 64 | private: 65 | Smb::FileHandler m_fd; 66 | Smb::Context m_context; 67 | qint64 m_curReadPosition; 68 | QFile::OpenMode m_openMode; 69 | }; 70 | 71 | #endif // SMBLOCATIONITEMFILE_H 72 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/qsambaclient/src/smbobject.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: smbobject.cpp 19 | * Date: 02/01/2015 20 | */ 21 | 22 | #include "smbobject.h" 23 | #include "smbutil.h" 24 | 25 | #include 26 | 27 | SmbObject::SmbObject(const QString &urlPath, Const_SmbUtil_Ptr smb) 28 | : CleanUrl(urlPath), m_smb(smb), m_smbOwnInstance(0) 29 | { 30 | if (m_smb == 0) 31 | { 32 | m_smb = m_smbOwnInstance = new SmbUtil(cleanUrl()); 33 | } 34 | } 35 | 36 | 37 | SmbObject::~SmbObject() 38 | { 39 | if (m_smbOwnInstance != 0) 40 | { 41 | delete m_smbOwnInstance; 42 | m_smbOwnInstance = 0; 43 | } 44 | } 45 | 46 | 47 | SmbUtil_Ptr SmbObject::smbObj() const 48 | { 49 | return const_cast(m_smb); 50 | } 51 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/qsambaclient/src/smbobject.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: smbobject.h 19 | * Date: 02/01/2015 20 | */ 21 | 22 | #ifndef SMBOBJECT_H 23 | #define SMBOBJECT_H 24 | 25 | #include "cleanurl.h" 26 | 27 | #include 28 | 29 | class SmbUtil; 30 | typedef SmbUtil const * Const_SmbUtil_Ptr; 31 | typedef SmbUtil * SmbUtil_Ptr; 32 | 33 | class SmbObject : public CleanUrl 34 | { 35 | protected: 36 | SmbObject(const QString &urlPath, Const_SmbUtil_Ptr smb = 0); 37 | SmbUtil_Ptr smbObj() const; 38 | public: 39 | virtual ~SmbObject(); 40 | protected: 41 | Const_SmbUtil_Ptr m_smb; 42 | SmbUtil_Ptr m_smbOwnInstance; //!< not zero only if smb == 0 43 | }; 44 | 45 | #endif // SMBOBJECT_H 46 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/qsambaclient/src/smbplaces.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2014 Canonical Ltd. 4 | * Copyright 2014 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: smbplaces.h 19 | * Date: 27/12/2014 20 | */ 21 | 22 | #ifndef SMBPLACES_H 23 | #define SMBPLACES_H 24 | 25 | #include 26 | #include 27 | 28 | class SmbPlacesThread; 29 | 30 | 31 | /*! 32 | * \brief The SmbPlaces class gets the list of current Samba/CIFS shares 33 | */ 34 | 35 | class SmbPlaces : public QObject 36 | { 37 | Q_OBJECT 38 | public: 39 | explicit SmbPlaces(QObject *parent = 0); 40 | ~SmbPlaces(); 41 | 42 | public: 43 | /*! 44 | * list all Samba/Cifs shares in sync mode, that means it may block any active UI 45 | * 46 | * \return the list of the shares in the current network 47 | */ 48 | Q_INVOKABLE QStringList listPlacesSync(); 49 | 50 | Q_INVOKABLE QStringList gePlaces() const; 51 | 52 | public slots: 53 | /*! 54 | * list all Samba/Cifs shares in async mode, the job is made on a secondary thread 55 | * that means it does not block any active UI 56 | * 57 | * After the job is done the signal \ref sharesList is emitted within the current shares list 58 | */ 59 | void listPlacesAsync(); 60 | 61 | signals: 62 | void sharesList(QStringList); 63 | 64 | private slots: 65 | void onSmbPlacesThreadFinished(); 66 | 67 | private: 68 | QStringList m_sharesList; 69 | SmbPlacesThread * m_thread; 70 | 71 | #if defined(REGRESSION_TEST_QSAMBACLIENT) 72 | friend class TestQSambaSuite; 73 | #endif 74 | 75 | }; 76 | 77 | #endif // SMBPLACES_H 78 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/qsambaclient/test/testsuite.pri: -------------------------------------------------------------------------------- 1 | QT *= testlib 2 | TEMPLATE = app 3 | CONFIG *= test 4 | 5 | ## this suite can be included in any Test Case main file 6 | SOURCES += $$PWD/testqsambasuite.cpp 7 | HEADERS += $$PWD/testqsambasuite.h 8 | 9 | INCLUDEPATH += $$PWD 10 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/smblocation.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: smblocation.h 19 | * Date: 17/01/2015 20 | */ 21 | 22 | #ifndef SMBLOCATION_H 23 | #define SMBLOCATION_H 24 | 25 | #include "networklocation.h" 26 | #include "smblocationauthentication.h" 27 | #include "smbobject.h" 28 | 29 | 30 | class SmbLocation : public NetworkLocation, public SmbLocationAuthentication 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit SmbLocation(int type, QObject *parent = 0); 36 | ~SmbLocation(); 37 | 38 | public: 39 | virtual DirItemInfo *newItemInfo(const QString &urlPath); 40 | virtual LocationItemDirIterator *newDirIterator(const QString &path, QDir::Filters filters, 41 | QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags, 42 | LocationItemDirIterator::LoadMode loadmode = LocationItemDirIterator::LoadOnConstructor); 43 | 44 | virtual LocationItemFile *newFile(const QString &path); 45 | virtual LocationItemDir *newDir(const QString &dir = QLatin1String(0)); 46 | virtual bool isThereDiskSpace(const QString &pathname, qint64 requiredSize); 47 | virtual QString urlBelongsToLocation(const QString &urlPath, int indexOfColonAndSlash); 48 | virtual QString currentAuthenticationUser(); 49 | virtual QString currentAuthenticationPassword(); 50 | 51 | public slots: 52 | virtual void setAuthentication(const QString &user, const QString &password); 53 | 54 | private: 55 | SmbUtil_Ptr m_smb; 56 | }; 57 | 58 | #endif // SMBLOCATION_H 59 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/smb/smblocationauthentication.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2015 Canonical Ltd. 4 | * Copyright 2015 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: smblocationauthentication.h 19 | * Date: 17/01/2015 20 | */ 21 | 22 | #ifndef SMBLOCATIONAUTHENTICATION_H 23 | #define SMBLOCATIONAUTHENTICATION_H 24 | 25 | #include "smbutil.h" 26 | 27 | /*! 28 | As the function to do the Samba authentication needs to be a static function 29 | it is necessary to have many static functions to allow many instances of SmbLocation 30 | (one SmbLocation instance matches a FileManager window) browsing for example the 31 | same samba URL using different users. 32 | */ 33 | #define MAX_AUTH_INSTANCES 4 34 | 35 | /*! 36 | * \brief The SmbLocationAuthentication class provides authentication Samba Authentication functions 37 | * 38 | * It intends to provide a set of functions and information (user/password) to have different instances of 39 | * objects doing samba authentication at same time 40 | */ 41 | class SmbLocationAuthentication 42 | { 43 | public: 44 | SmbLocationAuthentication(); 45 | ~SmbLocationAuthentication(); 46 | 47 | Smb::AuthenticationFunction suitableAuthenticationFunction() const; 48 | 49 | void setInfo(const QString &user, const QString &password); 50 | QString currentAuthUser() const; 51 | QString currentAuthPassword() const; 52 | 53 | static void authenticateCallBack0(const char *server, const char *share, char *wrkgrp, int wrkgrplen, char *user, int userlen, char *passwd, int passwdlen); 54 | static void authenticateCallBack1(const char *server, const char *share, char *wrkgrp, int wrkgrplen, char *user, int userlen, char *passwd, int passwdlen); 55 | static void authenticateCallBack2(const char *server, const char *share, char *wrkgrp, int wrkgrplen, char *user, int userlen, char *passwd, int passwdlen); 56 | static void authenticateCallBack3(const char *server, const char *share, char *wrkgrp, int wrkgrplen, char *user, int userlen, char *passwd, int passwdlen); 57 | 58 | private: 59 | int m_infoIndex; 60 | }; 61 | 62 | #endif // SMBLOCATIONAUTHENTICATION_H 63 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/trash/trashiteminfo.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2014 Canonical Ltd. 4 | * Copyright 2014 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: trashiteminfo.h 19 | * Date: 05/03/2014 20 | */ 21 | 22 | #ifndef TRASHITEMINFO_H 23 | #define TRASHITEMINFO_H 24 | 25 | #include "diriteminfo.h" 26 | 27 | 28 | /*! 29 | * \brief The TrashItemInfo class provides a QFileInfo like information for files in Trash 30 | * 31 | * Basically it differs from DirItemInfo in the field \a d_ptr->_normalizedPath, it must store the 32 | * url like trash:///Item, while the field d_ptr->_path stores the current path in the file system as usual. 33 | * 34 | * So suppose a Item in the trash: 35 | * \li \ref absoluteFilePath() returns like /home/user/.local/share/Trash/files/Item 36 | * \li \ref urlPath() returns trash:///Item 37 | * \li \ref getTrashDir() does a right-to-left comparing in order to find out the Trash Dir, in this case /home/user/.local/share/Trash/files 38 | * 39 | * The constructor \ref TrashItemInfo(const QString& urlPath) is used only to store the logical root trash folder trash:/// 40 | */ 41 | class TrashItemInfo : public DirItemInfo 42 | { 43 | public: 44 | TrashItemInfo(const QString &urlPath); 45 | TrashItemInfo(const QString &trashPath, const QString &urlPath); 46 | TrashItemInfo(const TrashItemInfo &other); 47 | 48 | public: 49 | virtual TrashItemInfo &operator=(const DirItemInfo &other); 50 | virtual TrashItemInfo &operator=(const TrashItemInfo &other); 51 | 52 | public: 53 | QString getTrashDir() const; 54 | QString getRootTrashDir() const; 55 | 56 | private: 57 | void setRoot(); 58 | void init(const QString &trashPath); 59 | }; 60 | 61 | #endif // TRASHITEMINFO_H 62 | -------------------------------------------------------------------------------- /src/plugin/folderlistmodel/urliteminfo.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2014 Canonical Ltd. 4 | * Copyright 2014 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: urliteminfo.h 19 | * Date: 08/12/2014 20 | */ 21 | 22 | #ifndef URLITEMINFO_H 23 | #define URLITEMINFO_H 24 | 25 | #include "diriteminfo.h" 26 | 27 | 28 | /*! 29 | * \brief The UrlItemInfo is an abstract class that provides URL root 30 | * 31 | * Basically it differs from DirItemInfo in the field \a d_ptr->_normalizedPath, it must store the 32 | * url like trash:///Item, while the field d_ptr->_path stores the current path in the file system as usual. 33 | * 34 | */ 35 | 36 | class UrlItemInfo : public DirItemInfo 37 | { 38 | public: 39 | static QStringList separatePathFilename(const QString &urlPath); 40 | protected: 41 | UrlItemInfo(const QString &urlPath, const QString &urlRoot); 42 | UrlItemInfo(); 43 | 44 | protected: 45 | void setRoot(const QString &urlRoot); 46 | 47 | 48 | private: 49 | void init(const QString &urlPath); 50 | void verifyHost(const QString urlPath); 51 | }; 52 | 53 | #endif // URLITEMINFO_H 54 | -------------------------------------------------------------------------------- /src/plugin/pamauthentication/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${CMAKE_CURRENT_SOURCE_DIR} 3 | ) 4 | 5 | set(PLUGIN_DIR com/ubuntu/PamAuthentication) 6 | 7 | set(pamauthentication_SRCS 8 | pamauthentication.cpp 9 | pamauthentication.h 10 | pamauthentication_plugin.cpp 11 | pamauthentication_plugin.h 12 | ) 13 | 14 | add_library(PamAuthentication MODULE 15 | ${pamauthentication_SRCS} 16 | ) 17 | 18 | target_link_libraries(PamAuthentication pam) 19 | 20 | qt5_use_modules(PamAuthentication Gui Qml Quick Widgets DBus) 21 | 22 | # Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator 23 | if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") 24 | add_custom_command(TARGET PamAuthentication POST_BUILD 25 | COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} 26 | COMMENT "Creating plugin directory layout in the build directory" 27 | COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} 28 | COMMENT "Copying the qmldir file to the build directory" 29 | COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} 30 | COMMENT "Copying the plugin binary to the build directory" 31 | ) 32 | endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") 33 | 34 | # Install plugin file 35 | install(TARGETS PamAuthentication DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR}) 36 | install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR}) 37 | 38 | -------------------------------------------------------------------------------- /src/plugin/pamauthentication/pamauthentication_plugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Author : Arto Jalkanen 17 | */ 18 | 19 | #include 20 | #include 21 | #include "pamauthentication_plugin.h" 22 | #include "pamauthentication.h" 23 | 24 | void BackendPlugin::registerTypes(const char *uri) 25 | { 26 | Q_ASSERT(uri == QLatin1String("com.ubuntu.PamAuthentication")); 27 | 28 | qmlRegisterType(uri, 0, 1, "PamAuthentication"); 29 | } 30 | 31 | void BackendPlugin::initializeEngine(QQmlEngine *engine, const char *uri) 32 | { 33 | QQmlExtensionPlugin::initializeEngine(engine, uri); 34 | } 35 | -------------------------------------------------------------------------------- /src/plugin/pamauthentication/pamauthentication_plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Author : Arto Jalkanen 17 | */ 18 | 19 | #ifndef PAMAUTHENTICATION_PLUGIN_H 20 | #define PAMAUTHENTICATION_PLUGIN_H 21 | 22 | #include 23 | #include 24 | 25 | class BackendPlugin : public QQmlExtensionPlugin 26 | { 27 | Q_OBJECT 28 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 29 | 30 | public: 31 | void registerTypes(const char *uri); 32 | void initializeEngine(QQmlEngine *engine, const char *uri); 33 | }; 34 | #endif // PAMAUTHENTICATION_PLUGIN_H 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/plugin/pamauthentication/qmldir: -------------------------------------------------------------------------------- 1 | module com.ubuntu.PamAuthentication 2 | plugin PamAuthentication 3 | -------------------------------------------------------------------------------- /src/plugin/placesmodel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${CMAKE_CURRENT_SOURCE_DIR} 3 | ) 4 | 5 | set(PLUGIN_DIR com/ubuntu/PlacesModel) 6 | 7 | set(placesmodel_SRCS 8 | placesmodel.cpp 9 | placesmodel.h 10 | placesmodel_plugin.cpp 11 | placesmodel_plugin.h 12 | qmtabparser.h 13 | qmtabparser.cpp 14 | ) 15 | 16 | add_library(PlacesModel MODULE 17 | ${placesmodel_SRCS} 18 | ) 19 | 20 | qt5_use_modules(PlacesModel Gui Qml Quick Widgets) 21 | 22 | # Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator 23 | if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") 24 | add_custom_command(TARGET PlacesModel POST_BUILD 25 | COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} 26 | COMMENT "Creating plugin directory layout in the build directory" 27 | COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} 28 | COMMENT "Copying the qmldir file to the build directory" 29 | COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} 30 | COMMENT "Copying the plugin binary to the build directory" 31 | ) 32 | endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") 33 | 34 | # Install plugin file 35 | install(TARGETS PlacesModel DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR}) 36 | install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR}) 37 | 38 | -------------------------------------------------------------------------------- /src/plugin/placesmodel/placesmodel_plugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Author : David Planella 17 | */ 18 | 19 | #include 20 | #include 21 | #include "placesmodel_plugin.h" 22 | #include "placesmodel.h" 23 | 24 | void BackendPlugin::registerTypes(const char *uri) 25 | { 26 | Q_ASSERT(uri == QLatin1String("com.ubuntu.PlacesModel")); 27 | 28 | qmlRegisterType(uri, 0, 1, "PlacesModel"); 29 | } 30 | 31 | void BackendPlugin::initializeEngine(QQmlEngine *engine, const char *uri) 32 | { 33 | QQmlExtensionPlugin::initializeEngine(engine, uri); 34 | } 35 | -------------------------------------------------------------------------------- /src/plugin/placesmodel/placesmodel_plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Author : David Planella 17 | */ 18 | 19 | #ifndef PLACESMODEL_PLUGIN_H 20 | #define PLACESMODEL_PLUGIN_H 21 | 22 | #include 23 | #include 24 | 25 | class BackendPlugin : public QQmlExtensionPlugin 26 | { 27 | Q_OBJECT 28 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 29 | 30 | public: 31 | void registerTypes(const char *uri); 32 | void initializeEngine(QQmlEngine *engine, const char *uri); 33 | }; 34 | #endif // PLACESMODEL_PLUGIN_H 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/plugin/placesmodel/qmldir: -------------------------------------------------------------------------------- 1 | module com.ubuntu.PlacesModel 2 | plugin PlacesModel 3 | -------------------------------------------------------------------------------- /src/plugin/placesmodel/qmtabparser.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Author : Arto Jalkanen 17 | * Carlos J Mazieri 18 | */ 19 | 20 | #include 21 | 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | class MtabFileGuard 28 | { 29 | FILE *mtabFile; 30 | 31 | public: 32 | MtabFileGuard(FILE *f) 33 | { 34 | mtabFile = f; 35 | } 36 | ~MtabFileGuard() 37 | { 38 | endmntent(mtabFile); 39 | } 40 | }; 41 | 42 | QMtabParser::QMtabParser(const QString &path, QObject *parent) 43 | : QObject(parent) 44 | { 45 | m_path = path.isEmpty() ? _PATH_MOUNTED : path; 46 | } 47 | 48 | QMtabParser::~QMtabParser() {} 49 | 50 | QList 51 | QMtabParser::parseEntries() 52 | { 53 | QList entries; 54 | 55 | FILE *f = setmntent(m_path.toLocal8Bit().data(), "r"); 56 | if (f == 0) { 57 | return entries; 58 | } 59 | 60 | MtabFileGuard guard(f); 61 | 62 | struct mntent entStorage; 63 | char buffer[1024]; 64 | while (mntent *ent = getmntent_r(f, &entStorage, buffer, 1024)) { 65 | QMtabEntry entry; 66 | entry.fsName = ent->mnt_fsname; 67 | entry.dir = ent->mnt_dir; 68 | entry.type = ent->mnt_type; 69 | entry.opts = ent->mnt_opts; 70 | entry.freq = ent->mnt_freq; 71 | entry.passno = ent->mnt_passno; 72 | entries << entry; 73 | } 74 | 75 | return entries; 76 | } 77 | -------------------------------------------------------------------------------- /src/plugin/placesmodel/qmtabparser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | * Author : Arto Jalkanen 17 | * Carlos J Mazieri 18 | */ 19 | 20 | #ifndef QMTABPARSER_H 21 | #define QMTABPARSER_H 22 | 23 | #include 24 | 25 | struct QMtabEntry { 26 | QString fsName; 27 | QString dir; 28 | QString type; 29 | QString opts; 30 | int freq; 31 | int passno; 32 | }; 33 | 34 | class QMtabParser : public QObject 35 | { 36 | Q_OBJECT 37 | QString m_path; 38 | 39 | public: 40 | explicit QMtabParser(const QString &path = QString(), QObject *parent = 0); 41 | ~QMtabParser(); 42 | 43 | QList parseEntries(); 44 | 45 | inline const QString &path() 46 | { 47 | return m_path; 48 | } 49 | }; 50 | 51 | #endif // QMTABPARSER_H 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/regression/media_asx.h: -------------------------------------------------------------------------------- 1 | const unsigned char media_asx[] = { 2 | 0x3c, 0x61, 0x73, 0x78, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 3 | 0x3d, 0x22, 0x33, 0x2e, 0x30, 0x22, 0x3e, 0x0d, 0x0a, 0x3c, 0x65, 0x6e, 4 | 0x74, 0x72, 0x79, 0x3e, 0x0d, 0x0a, 0x3c, 0x72, 0x65, 0x66, 0x20, 0x68, 5 | 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 6 | 0x72, 0x65, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x62, 0x61, 0x63, 0x61, 7 | 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 8 | 0x61, 0x79, 0x2f, 0x67, 0x65, 0x74, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 9 | 0x61, 0x73, 0x70, 0x3f, 0x73, 0x63, 0x3d, 0x77, 0x74, 0x72, 0x78, 0x2d, 10 | 0x66, 0x6d, 0x22, 0x20, 0x2f, 0x3e, 0x0d, 0x0a, 0x3c, 0x2f, 0x65, 0x6e, 11 | 0x74, 0x72, 0x79, 0x3e, 0x0d, 0x0a, 0x3c, 0x65, 0x6e, 0x74, 0x72, 0x79, 12 | 0x3e, 0x0d, 0x0a, 0x3c, 0x72, 0x65, 0x66, 0x20, 0x68, 0x72, 0x65, 0x66, 13 | 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6d, 0x65, 0x64, 14 | 0x69, 0x61, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x61, 0x64, 0x73, 15 | 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x64, 16 | 0x61, 0x74, 0x61, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 17 | 0x73, 0x78, 0x2f, 0x57, 0x54, 0x52, 0x58, 0x2e, 0x61, 0x73, 0x78, 0x22, 18 | 0x20, 0x2f, 0x3e, 0x0d, 0x0a, 0x3c, 0x2f, 0x65, 0x6e, 0x74, 0x72, 0x79, 19 | 0x3e, 0x0d, 0x0a, 0x3c, 0x2f, 0x61, 0x73, 0x78, 0x3e, 0x0d, 0x0a 20 | }; 21 | qint64 media_asx_len = 215; 22 | -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/regression/regression_folderlilstmodel.pro: -------------------------------------------------------------------------------- 1 | QT += testlib 2 | TEMPLATE = app 3 | CONFIG += testcase 4 | 5 | QT += core gui 6 | 7 | greaterThan(QT_MAJOR_VERSION, 4) { 8 | QT += widgets quick 9 | } 10 | 11 | #------------------------------------------------ 12 | 13 | DEFINES += REGRESSION_TEST_FOLDERLISTMODEL 14 | 15 | SOURCES += tst_folderlistmodel.cpp 16 | 17 | include (../../folderlistmodel/folderlistmodel.pri) 18 | 19 | include (../../folderlistmodel/smb/qsambaclient/test/testsuite.pri) 20 | 21 | HEADERS += \ 22 | tempfiles.h 23 | 24 | SOURCES += \ 25 | tempfiles.cpp 26 | 27 | INCLUDEPATH += $$PWD 28 | 29 | # DEFINES += DEBUG_REMOVE 30 | 31 | #DEFINES += DEBUG_EXT_FS_WATCHER 32 | 33 | -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/regression/ubuntu_touch_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export APP_ID=com.ubuntu.filemanager_filemanager_test 4 | 5 | DESKTOP=`ls /usr/share/applications/*.desktop | tail -1` 6 | 7 | ## any application which uses QApplication crashes without --desktop_file_hint=valid_desktop_file 8 | 9 | ./regression_folderlilstmodel --desktop_file_hint=$DESKTOP $* 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/results/NemoEmulatorQ8.43.txt: -------------------------------------------------------------------------------- 1 | ********* Start testing of TestDirModel ********* 2 | Config: Using QTest library 4.8.3, Qt 4.8.3 3 | PASS : TestDirModel::initTestCase() 4 | PASS : TestDirModel::fsActionRemoveSingleFile() 5 | PASS : TestDirModel::fsActionRemoveSingleDir() 6 | PASS : TestDirModel::fsActionRemoveOneFileOneDir() 7 | PASS : TestDirModel::fsActionRemoveTwoFilesTwoDirs() 8 | PASS : TestDirModel::modelRemoveRecursiveDirByIndex() 9 | PASS : TestDirModel::modelRemoveMultiItemsByFullPathname() 10 | PASS : TestDirModel::modelRemoveMultiItemsByName() 11 | PASS : TestDirModel::modelCopyDirPasteIntoAnotherModel() 12 | PASS : TestDirModel::modelCopyManyItemsPasteIntoAnotherModel() 13 | PASS : TestDirModel::modelCutManyItemsPasteIntoAnotherModel() 14 | PASS : TestDirModel::fsActionMoveItemsForcingCopyAndThenRemove() 15 | PASS : TestDirModel::modelCancelRemoveAction() 16 | PASS : TestDirModel::modelTestFileSize() 17 | PASS : TestDirModel::modelRemoveDirWithHiddenFilesAndLinks() 18 | PASS : TestDirModel::modelCancelCopyAction() 19 | PASS : TestDirModel::modelCopyFileAndDirectoryLinks() 20 | PASS : TestDirModel::modelCopyAndPaste3Times() 21 | PASS : TestDirModel::modelCutAndPaste3Times() 22 | SKIP : TestDirModel::getThemeIcons() invalid QIcon::fromTheme text-plain 23 | Loc: [/mnt/mint14kde/home/carlos/ubuntu_work/bazarrepo/test_folderlistmodel/regression/tst_folderlistmodel.cpp(1006)] 24 | QWARN : TestDirModel::fileIconProvider() QFileIconProvider::File or a BAD icon from QFileIconProvide::icon() for /var/tmp/tst_folderlistmodel_test.mp3 25 | QWARN : TestDirModel::fileIconProvider() QFileIconProvider::File or a BAD icon from QFileIconProvide::icon() for /var/tmp/tst_folderlistmodel_test.pdf 26 | QWARN : TestDirModel::fileIconProvider() QFileIconProvider::File or a BAD icon from QFileIconProvide::icon() for /var/tmp/tst_folderlistmodel_test.asx 27 | QWARN : TestDirModel::fileIconProvider() QFileIconProvider::File or a BAD icon from QFileIconProvide::icon() for /var/tmp/tst_folderlistmodel_test.xspf 28 | PASS : TestDirModel::fileIconProvider() 29 | QWARN : TestDirModel::openMP3() GOOD: QDesktopServices::openUrl() works for MP3 files 30 | PASS : TestDirModel::openMP3() 31 | QWARN : TestDirModel::openTXT() GOOD: QDesktopServices::openUrl() works for TEXT files 32 | PASS : TestDirModel::openTXT() 33 | PASS : TestDirModel::openPDF() 34 | PASS : TestDirModel::cleanupTestCase() 35 | Totals: 24 passed, 0 failed, 1 skipped 36 | ********* Finished testing of TestDirModel ********* 37 | -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/results/openFiles.Readme.txt: -------------------------------------------------------------------------------- 1 | 2 | On Nemo emulator tried to open files using QDesktopServices::openUrl() 3 | ======================================================= 4 | 5 | mp3 file -> attempted to open in Internet browser and got stuck 6 | txt file -> opened in the browser 7 | pdf file -> attempted to open in Internet browser and got stuck 8 | -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/main.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2013 Canonical Ltd. 4 | * Copyright 2013 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: main.cpp 19 | * Date: 3/9/2013 20 | */ 21 | 22 | #include "simplelist.h" 23 | #include 24 | 25 | int main(int argc, char *argv[]) 26 | { 27 | QApplication a(argc, argv); 28 | SimpleList w; 29 | w.show(); 30 | 31 | return a.exec(); 32 | } 33 | -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/placesmodel.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2014 Canonical Ltd. 4 | * Copyright 2014 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: placesmodel.h 19 | * Date: 21/04/2014 20 | */ 21 | 22 | #ifndef PLACESMODEL_H 23 | #define PLACESMODEL_H 24 | 25 | #include 26 | #include 27 | 28 | class PlacesModel : public QAbstractListModel 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit PlacesModel(QObject *parent = 0); 33 | 34 | virtual QVariant data(const QModelIndex &index, int role) const; 35 | virtual int rowCount(const QModelIndex &) const 36 | { return m_places.count(); } 37 | 38 | QString pathFrom(int row) const; 39 | 40 | private: 41 | void addPlace(const QString& n, 42 | const QString& i, 43 | const QStringList& u); 44 | 45 | private: 46 | struct Place 47 | { 48 | public: 49 | Place(const QString&n, const QString& i): 50 | name(n), 51 | icon(i) 52 | { 53 | 54 | } 55 | QString name; 56 | QIcon icon; 57 | QString urlPath; 58 | }; 59 | 60 | QList m_places; 61 | }; 62 | 63 | #endif // PLACESMODEL_H 64 | -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/res.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | resources/xterm_48x48.xpm 4 | resources/home-page.png 5 | resources/recyclebin_full.png 6 | resources/empty_trash.png 7 | resources/undo.png 8 | resources/go-previous.png 9 | resources/go-up.png 10 | resources/edit-rename.png 11 | resources/folder-new.png 12 | resources/copy.png 13 | resources/cut.png 14 | resources/filenew.png 15 | resources/remove.png 16 | resources/trash.png 17 | resources/paste.png 18 | resources/temp_folder.png 19 | resources/red_folder.png 20 | resources/document_folder.png 21 | resources/downloads_folder.png 22 | resources/server.png 23 | resources/workgroup.png 24 | resources/samba_folder.png 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/copy.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/cut.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/document_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/document_folder.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/downloads_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/downloads_folder.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/edit-rename.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/edit-rename.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/empty_trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/empty_trash.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/exit.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/fileclose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/fileclose.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/filenew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/filenew.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/fileopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/fileopen.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/folder-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/folder-new.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/go-previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/go-previous.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/go-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/go-up.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/home-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/home-page.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/paste.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/recyclebin_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/recyclebin_full.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/red_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/red_folder.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/remove.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/samba_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/samba_folder.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/server.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/temp_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/temp_folder.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/trash.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/undo.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/workgroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/src/plugin/test_folderlistmodel/simpleUI/resources/workgroup.png -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/resources/xterm_48x48.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * xterm_48x48_xpm[] = { 3 | "48 48 2 1", 4 | " c #000000", 5 | ". c #FFFFFF", 6 | "................................................", 7 | "...... ........", 8 | "..... .................................. ......", 9 | "..... ... ... . .....", 10 | "..... .. ............................ .. .. ....", 11 | "..... . .............................. . ... ...", 12 | "..... . . .... ................... . .... ..", 13 | "..... . .. .... .................... . .... ..", 14 | "..... . ... .. ..................... . .... ..", 15 | "..... . ... .. ..................... . .... ..", 16 | "..... . .... ...................... . .... ..", 17 | "..... . .... ...................... . .... ..", 18 | "..... . ..... ....................... . .... ..", 19 | "..... . .... ...................... . .... ..", 20 | "..... . .... ...................... . .... ..", 21 | "..... . ... .. ..................... . .... ..", 22 | "..... . ... .. ..................... . .... ..", 23 | "..... . .. .... .................... . .... ..", 24 | "..... . . .... ................... . .... ..", 25 | "..... . .............................. . .... ..", 26 | "..... . .............................. . .... ..", 27 | "..... . . . .. ... ... . . .... ..", 28 | "..... . ... .... ...... ... .. ... . . .... ..", 29 | "..... . ... .... ...... ... .. . . . . . .... ..", 30 | "..... . ... .... ... ... . . . . . .... ..", 31 | "..... . ... .... ...... . .... .. .. . . ... ...", 32 | "..... . ... .... ...... .. ... .. .. . . ... ...", 33 | "..... . ... .... .. ... .. ..... . . .. ....", 34 | "..... . .............................. . .. ....", 35 | "..... . .............................. . . .....", 36 | "..... .. ............................ .. . .....", 37 | "..... ... ... ......", 38 | "..... .................................. ......", 39 | "...... ........", 40 | "................................................", 41 | "................................................", 42 | "...... ......", 43 | "..... .................................. ......", 44 | "..... . . . . . . . . . . . . . . . . .. ......", 45 | ".... .................................. . ......", 46 | ".... . . . . . . . . . . . . . . . . .. . ......", 47 | "... .................................. .. ......", 48 | "... . . . . . . . . . . . . . . . . .. .. ......", 49 | ".. .................................. .. .......", 50 | ".. . . . . . ........", 51 | ". .................................. . .........", 52 | ". ..........", 53 | "................................................"}; 54 | -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/simplelist.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright 2013 Canonical Ltd. 4 | * Copyright 2013 Carlos J Mazieri 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation; version 3. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * File: simplelist.h 19 | * Date: 3/9/2013 20 | */ 21 | 22 | #ifndef SIMPLELIST_H 23 | #define SIMPLELIST_H 24 | 25 | #include 26 | #include 27 | 28 | class DirModel; 29 | class QProgressBar; 30 | class DirSelection; 31 | class PlacesModel; 32 | class QDialog; 33 | 34 | namespace Ui { 35 | class SimpleList; 36 | class AuthenticationDialog; 37 | } 38 | 39 | class SimpleList : public QMainWindow 40 | { 41 | Q_OBJECT 42 | 43 | public: 44 | explicit SimpleList(QWidget *parent = 0); 45 | ~SimpleList(); 46 | 47 | protected: 48 | bool eventFilter(QObject *obj, QEvent *event); 49 | 50 | private: 51 | void allowSelectedActions(int selectedCounter); 52 | void allowTrashActions(bool enable); 53 | void do_connections(); 54 | 55 | private: 56 | Ui::SimpleList *ui; 57 | DirModel *m_model; 58 | QProgressBar * m_pbar; 59 | DirSelection * m_selection; 60 | bool m_holdingCtrlKey; 61 | bool m_holdingShiftKey; 62 | Qt::MouseButton m_button; 63 | PlacesModel * m_placesModel; 64 | QDialog * m_authDialog; 65 | Ui::AuthenticationDialog *m_uiAuth; 66 | 67 | private slots: 68 | void onNewDir(); 69 | void onRename(); 70 | void onRowClicked(QModelIndex); 71 | void onOpenItem(QModelIndex index); 72 | void onSetSort(int col, Qt::SortOrder order); 73 | void onProgress(int, int,int); 74 | void onClipboardChanged(); 75 | void onError(QString title, QString message); 76 | void onPathChanged(QString path); 77 | void onPathChoosedFromList(int); 78 | void onPathComboEdited(); 79 | void onSelectionChanged(int); 80 | void onPlacesClicked(QModelIndex); 81 | void onOpenTerminal(); 82 | void onAwaitingResultsChanged(); 83 | void onRowsInserted(QModelIndex, int,int); 84 | void onNeedsAutentication(QString, QString); 85 | void onAuthenticaionAccepted(); 86 | }; 87 | 88 | #endif // SIMPLELIST_H 89 | -------------------------------------------------------------------------------- /src/plugin/test_folderlistmodel/simpleUI/simpleui.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2013-03-09T12:30:11 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | 9 | 10 | greaterThan(QT_MAJOR_VERSION, 4) { 11 | QT += widgets quick 12 | } 13 | 14 | TEMPLATE = app 15 | 16 | DEFINES += REGRESSION_TEST_FOLDERLISTMODEL SIMPLE_UI 17 | 18 | SOURCES += main.cpp simplelist.cpp simpleslots.cpp placesmodel.cpp terminalfolderapp.cpp 19 | 20 | HEADERS += simplelist.h placesmodel.h terminalfolderapp.h 21 | 22 | FORMS += simplelist.ui authenticationdialog.ui 23 | 24 | include (../../folderlistmodel/folderlistmodel.pri) 25 | 26 | #DEFINES += DEBUG_REMOVE 27 | 28 | DEFINES += SIMULATE_LONG_ACTION DEBUG_EXT_FS_WATCHER 29 | 30 | RESOURCES += res.qrc 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/plugin/test_placesmodel/test_placesmodel.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2015-09-05T17:37:49 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += testlib 8 | 9 | QT -= gui 10 | 11 | TARGET = tst_placesmodeltest 12 | CONFIG += console 13 | CONFIG += testcase 14 | CONFIG -= app_bundle 15 | 16 | TEMPLATE = app 17 | 18 | DEFINES += REGRESSION_TEST_PLACES_MODEL 19 | 20 | DEFINES += SRCDIR=\\\"$$PWD/\\\" 21 | 22 | QMAKE_CXXFLAGS += -std=c++11 23 | 24 | 25 | SOURCES += placesmodeltest.cpp \ 26 | ../placesmodel/placesmodel.cpp \ 27 | ../placesmodel/qmtabparser.cpp 28 | 29 | 30 | HEADERS += \ 31 | ../placesmodel/placesmodel.h \ 32 | ../placesmodel/qmtabparser.h 33 | 34 | 35 | INCLUDEPATH += ../placesmodel 36 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(autopilot) 2 | -------------------------------------------------------------------------------- /tests/autopilot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(INSTALL_TESTS) 2 | execute_process(COMMAND python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" 3 | OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) 4 | 5 | install(DIRECTORY ${AUTOPILOT_DIR} 6 | DESTINATION ${PYTHON_PACKAGE_DIR} 7 | ) 8 | endif(INSTALL_TESTS) 9 | 10 | add_subdirectory(filemanager) 11 | -------------------------------------------------------------------------------- /tests/autopilot/filemanager/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # make the emulator files visible on qtcreator 2 | file(GLOB PYTHON_EMULATOR_FILES 3 | RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 4 | *.py) 5 | 6 | add_custom_target(com_ubuntu_filemanager_PYTHONEMULATORFiles ALL SOURCES ${PYTHON_EMULATOR_FILES}) 7 | 8 | add_subdirectory(tests) 9 | -------------------------------------------------------------------------------- /tests/autopilot/filemanager/content/Test.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/tests/autopilot/filemanager/content/Test.tar -------------------------------------------------------------------------------- /tests/autopilot/filemanager/content/Test.tar.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/tests/autopilot/filemanager/content/Test.tar.bz2 -------------------------------------------------------------------------------- /tests/autopilot/filemanager/content/Test.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/tests/autopilot/filemanager/content/Test.tar.gz -------------------------------------------------------------------------------- /tests/autopilot/filemanager/content/Test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubports/filemanager-app/89cc6ba786e619ac1c6554098da4343f40a77b52/tests/autopilot/filemanager/content/Test.zip -------------------------------------------------------------------------------- /tests/autopilot/filemanager/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # make the test files visible on qtcreator 2 | file(GLOB PYTHON_TEST_FILES 3 | RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 4 | *.py) 5 | 6 | add_custom_target(com_ubuntu_filemanager_PYTHONTESTFiles ALL SOURCES ${PYTHON_TEST_FILES}) 7 | -------------------------------------------------------------------------------- /tests/autopilot/filemanager/tests/test_places.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- 2 | # 3 | # Copyright (C) 2013, 2014 Canonical Ltd. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU Lesser General Public License as published by 7 | # the Free Software Foundation; version 3. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with this program. If not, see . 16 | 17 | from autopilot.matchers import Eventually 18 | from testtools.matchers import Equals 19 | 20 | from filemanager.tests import FileManagerTestCase 21 | 22 | 23 | class PlacesTestCase(FileManagerTestCase): 24 | """Test cases for the places section of the file manager app.""" 25 | 26 | def test_go_home_must_open_the_home_directory(self): 27 | """Test that opens the Home bookmark from the places section.""" 28 | self.app.main_view.go_to_place('placeHome', None) 29 | 30 | folder_list_page = self.app.main_view.get_folder_list_page() 31 | self.assertThat( 32 | folder_list_page.get_current_path, 33 | Eventually(Equals(self.fakehome))) 34 | 35 | def test_go_to_root_must_open_the_root_directory(self): 36 | """Test that opens the Device bookmark from the places section.""" 37 | self.app.main_view.go_to_place('placeDevice', None) 38 | 39 | folder_list_page = self.app.main_view.get_folder_list_page() 40 | self.assertThat( 41 | folder_list_page.get_current_path, 42 | Eventually(Equals('/'))) 43 | --------------------------------------------------------------------------------