Cherry-picking upstream release 0.11.1.

* Synced debian foo with experimental
* Removed --parallel from rules, standard compat 10
* New dep. default-dbus-session-bus | dbus-session-bus | dbus-x11
  (Closes: #836284)
* Fixed Crashes while copying (Closes: #823753)
* Bumped minimum version libfm-qt-dev (>= 0.11.1)
* Bumped minimum version libqt5xdg-dev (>= 2.0.0)
* Added build dependency libkf5windowsystem-dev
* Added build dependency libqt5svg5-dev
* Added build dependency liblxqt0-dev (>= 0.11.0)
* Added Recommends pcmanfm-qt-l10n
* Fixed VCS fields, using plain /git/
* Fixed copyright Format field, using https
* Dropped patches, applied upstream
* Added translation controls
* Set CMAKE_BUILD_TYPE=RelWithDebInfo
ubuntu/cosmic debian/0.11.1-2
Alf Gaida 8 years ago
parent 49f999091b
commit 98bdec9473

1
.gitignore vendored

@ -1,2 +1,3 @@
build build
*.kdev4 *.kdev4
pcmanfm/translations/pcmanfm-qt

@ -0,0 +1,569 @@
pcmanfm-qt-0.11.1 / 2016-09-24
==============================
* Bump version to 0.11.1 (#399)
* Extend README.md
* Ensure the existence of libfm dir.
* Fix the bug that breaks sort folder first option.
* Preserve per-folder view settings. * Code refactor and cleanup. * Use Fm::FolderConfig internally for storing the per-folder settings.
* Per-folder saving of sorting and view mode
* Use libfm-qt C++ wrappers instead of the original libfm C API whenever possible.
* Replace tilde with home path (#371)
* Fix -Wswitch warning
* Use LXQtCompilerSettings cmake module
* Replaces deprecated QStyleOptionViewItemV4
* Fixes two typos (#381)
* Add Arabic Translations for Desktop Files
* I18N: Fix plural string (#374)
* Fix some icons for RTL (#366)
* Use a wide spread icon theme as fallback for the time beeing (#359)
* build: Use external translations
* ts-files removal (#352)
* Fix memory leak in main window tool bar (#350)
* Change "compact icon view" in "icon view" (#349)
* Merge pull request #341 from lxde/desktop_sort_settings
* Add some tooltips to Pref dialog
* Add setting for Desktop con size
* Fix a few compiler warnings
0.11.0 / 2016-03-13
===================
* Switch automatically to newly opened tabs
* Fixes libfm-qt dependency contradiction on README.md
* Optional fullwidth tabbar By default, the tabbar is stretched over the left pane too. This commit makes that optional with a check button in the UI page of the Preferences dialog. It's checked by default but if unchecked, the tabbar will be positioned right above the folder-view.
* A toolbar button appearing on hiding menubar It has a dropdown menu containing all menubar items, is added to the end of toolbar, after a separator, when menubar is hidden and is removed (hidden) with its separator when menubar is shown.
* fix new grep 2.23 behaviour for the time beeing
* Bump year
* Bump version number to 0.11.0, preparing for a new release.
* Add hide menu bar menu entry
* Add menubar actions to the main window
* Return focus to the folder view when hitting escape
* Added options for min. item margins. Also included a fix (or workaround) for text shadow resetting.
* Added shortcut(s) for filterbar. Also added Ctrl+F, in addition to F3, for the search utility and cleared filter string for all tabs when closing the filterbar.
* Make it possible to hide the menu bar
* Set quit shortcut from the ui file
* Update the tab bar visibility when the settings change
* Add quit shortcut
* Always draw the text shadow on desktop. Also fixed the selected text color.
* Update czech translation (by Petr Balíček <pbalicek@seznam.cz>)
* Improve french translation
* Move the XdndWorkaround to libfm-qt internal instead.
* Fixed a crash on right clicking trashed files.
* Select all of the text in the path entry when focusing it using shortcut keys Alt+D and Ctrl+L.
* Use lxqt-sudo as the default su tool instead of gksu.
* Add some ``beautiful'' workarounds that bypass Qt bug #49947 and 47981. This should fix the bug lxqt/#688 temporarily.
* Prevent large gaps at desktop bottom
* Update pcmanfm-qt_it.ts
* Let the style engine draw the text selection rect on desktop.
* options: Make options of wallpaper-mode switch untranslatable
* turkiash translate files added
* Fix --wallpaper-mode description in translations
* Polish translation updated
* Polish translation updated
* Fix --show-pref option not switching to next name
* Add config values for customizing "places" (not implemented yet).
* Updated Russian translation Removed ru_RU files
0.10.1 / 2015-12-05
===================
* hide 'Create New...' menu for files
* Russian translation update
* Deal with CMAKE POLICY 0063
* Use CMAKE_CXX_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN
* Adds Clang support to symbols visibility
* Fix typo in setting key
* hide 'Paste' in file context menu
* restore 'Open with...' for directories in left panel
* Fix referencing generated headers in translations
* CMake: Drop qt5_use_modules()
* CMake: Use the new libfm-qt Targets
* Move libfm-qt to its own repository.
split-libfm-qt / 2015-11-24
===========================
* Fix typos in man page
* Update French translation
* Tab context menu for closing other tabs
* Italian translation updates
* Add bindings to Ctrl+PgUp/Ctrl+PgDn.
* Update French translation of GPL license
* Fix a random crash related to editing the bookmarks by disconnecting from GObject signals properly.
* Fix a crash triggered when unmounting a volume from the side pane.
* Avoid duplicated volumes and mounts in the side panel. (This fixes the mtp:// problem.)
* Select the item of the previously folder in current folder view if it's a direct child of the current folder.
* Fix missing null pointer check in Fm::Path::parent() and use nullptr instead of NULL in path.h.
* Code cleanup, «using» directive only if necessary
* Upgrade of pcmanfm-qt to C++11
* Fix setting a SIGTERM handler with undefined flags
* Fix two typos in README
* Force the root config dir on the root instance
* Fix --version option not displaying version
* hu translations updated
* Fixed several problems with item selection and alignment
* Fix CMake LICENSE path
* Fix compiling with Qt < 5.4
* Move LICENSE file
* Check for null pointers.
* Changed the static wentUp to the private variable wentUp_.
* Select the folder from where we have gone up.
0.10.0 / 2015-11-02
===================
* Release 0.10.0
* Remove unnecessary qDebug traces
* Update zh_TW translations.
* Update translations.
* Provide an option in the view menu to turn off the filter bar (turned off by default).
* The signal QAbstractItemView::iconSizeChanged is only available after Qt 5.5. Add workarounds for older Qt versions.
* Add more null pointer checks in the thumbnail loader to avoid crashes caused by older versions of libfm.
* Fix CPack README path
* Update translations
* Use markdown for README
* Bump minimum CMake to 3.0.2
* Reduce margin and spacing of the central widget
* Avoid the column resizing tricks for the detailed list view when the view contains no columns.
* Improve the column width computation for the detailed view
* Some code cleanup.
* desktop: Makes the Desktop Folder Edit functionality optional
* desktop: Renames Advanced page config layout manager
* PlacesView: activate on click on the second column
* SidePane: reduce size of button's column width
* Remove ugly board of main window's central widget
* Added a filterbar + Handle virtually hidden files
* Russian translation update
* Prevent the desktop window from being closed accidentally. This fixes #194.
* mouse fix
* Update cs_CZ translation with the strings provided by petrbal in pull request #218.
* Add apply button to desktop preferences dialog
* Removed pcmanfm-qt.kdev4 and fixed .gitignore
* desktop: Makes the preferences dialog General page tighter
* Add a shortcut key "F3" for launching the file searching utility. * Small UI layout adjistment.
* Allow adding or removing paths in the file search dialog. Fix bugs in searching for documents.
* Try to implement file searching by using the new Fm::FileSearchDialog class.
* Fix a incorrecy free() in fm_search_free() API.
* Add Fm::Path::take() API to take the ownership of a raw FmPath pointer.
* Add class Fm::FileSearchDialog used to show a dialog for searching files.
* Add FmSearch API which is used to build a search:// URI. (implemented in C and might become part of libfm later).
* Fix #197 by using a different method to forward the XCB mouse events to the root window.
* Fix #195 - Crash when rightclick on item in trash.
* Add a null check for FmFileInfo in Fm::ProxyFolderModel::lessThan(). This closes #205.
* Fix (workaround) for right-click crash in placesview.
* Russian translation: update
* Italian translation: add desktop entry files, adjust TS files
* placesview: middle-click correct item to activate (fix of segfault)
* Paste into folder from its context menu.
* libfm-qt: updated german translation
* libfm-qt: lupdated translation files
* Add Greek (el) translation
* added support for mouse back/forward buttons
* Add few missing Polish translations and modify few existing.
* xdg main category added
* Update German translation
* fixed paths in .ts files + lupdate
* Update German translation
* Update Russian translation
* CMake: Remove unused INSTALL variables
* Support opening items in the bookmarks menu in new tabs or new windows.
* Add new signal prepareFileMenu() to Fm::SidePane and Fm::DirTree so there's a chance to customize the file menu before its shown.
* Port some missing config options from the gtk+ version of pcmanfm.
* Also show hidden dirs in the directory tree when the "Show Hidden" option in the menu is turned on.
* Fix #190 - Column layout is not always updated.
* Fix relative paths in command line arguments. Close lxde/pcmanfm-qt#170 - relative paths stated by xdg-open not considered.
* Create New menu actions, context menu in tree side pane, #163.
* Install SIGTERM handler to save settings when logging out, #157.
* Store side pane mode setting, #157.
* Adds UPDATE_TRANSLATIONS option to the top CMakeLists
* Fixes an translation regression
* Updates translations
* Handles .desktop files translations
* Uses LXQt lxqt_translate_ts() to handle translations
* Add German translation of pcmanfm-qt.desktop
* Fix lxde/lxqt#447 - missing actions in Places' context menus
* Remove trailing whitespaces
* polishing German translation
* Add menu items and shortcuts for new folder and blank file, fixes #163.
*_hu desktops added
* Display folders first when active and sort order descending, fixes #179.
* Avoid space wasted by incorrect decoration in detailed view columns, fixes #177.
* Avoid flickering column header while resizing manually, fixes #176.
* Update pcmanfm-qt_it.ts
* Fix loading new desktop dir
* Hungarian translation
* Fix #627 - long startup time. (This blocking is caused by checking the availability of "network:///".)
* Enable text selection in file properties dialog
* Fixes #168 - qunsetenv("QT_NO_GLIB"); required before constructing the application.
* Fix some memory leaks reported by valgrind.
* Fix warnings reported by cppcheck.
* Fix warnings reported by scan-build.
* Sort indicators in detailed view, store column and order in settings, fixes #109.
* Fix lxde/lxqt#512 - pcmanfm-qt: cannot delete to trash.
* Fix lxde/lxqt#512 - "pcmanfm-qt: cannot delete to trash" by using a safer way to check trash:/// support.
* Polish translations added
* Bumps version
* Rearrange tab order (tabstops)
* Use 'user-trash' icon for 'Move to Trash'
* The "Custom" option in the application chooser combo box inside file properties dialog is broken. Fix by preventing recursive signal handler invocation.
* The file property dialog does not show correct default applications. Fix a bug in AppChooserComboBox::setMimeType() that does incorrect app comparison.
* When converting an UID or GID to its name, show the number as string when the user or group does not exists.
0.9.0 / 2015-02-05
==================
* Add more null checks.
* Fix #130 - Remember width of side panel.
* Portuguese update
* Add very basic "remaining time" display to the progress dialog. Fix lxde/lxqt#463 - Progress dialog of pcmanfm-qt does not show remaining time.
* Fix lxde/pcmanfm-qt#120 - Foucs "Rename" button when file name changed.
* remember maximized state
* Remove unnecessary '\n' charactor from the translated strings.
* Fix translations (the newly added string comes from the translation of libfm).
* Improve trash can handling: provide an option to delete the files if moving to trashcan fails.
* Fix broken filenames of translation files.
* Support NoUsbTrash option and fix #125 - "Move to trash " on mounted devices.
* Bump version numbers, preparing for a new release.
* Completely remove dependency on libqtxdg.
* More migration to Qt5 new signal/slot syntax for better type safety & speed.
* Migrade to new Qt5 signal/slot syntax for better type safety and speed.
* Fix the broken sorting option.
* Fix lxde/lxqt#448 - PCmanFM-QT renaming place bookmarks does nothing.
* Fix broken rememberWindowSize settings.
* Portuguese update
* Support linguistic sorting of file names. This fixes #105.
* Avoid using Qt 5.4 API if compiled with older Qt versions. Fix #121.
* Update the folder model & view after files are changed.
* Open folders in new tabs by middle clicking on items in the side pane.
* Support reordering of tabs using drag and drop.
* Portuguese update
* Fix a crash of the context menu of places view caused by change of items.
* Save the result of "Edit bookmarks" to gtk+3 bookmarks file instead of the deprecated ~/.gtkbookmarks file. This fixes bug #112 partially.
* Fix #396: pcmanfm-qt back and/or up does not remember position.
* Add spanish translations
* Adds GUI to change desktop dir in Desktop preferences. Uses libqtxdg.
* Add .gitignore
* Update Japanese translation
* Add German translation
* add Japanese translation
* Implement "UnTrash" for files in trash:/// and close lxde/lxqt#136.
* Handle command line URIs correctly and fix bug lxde/lxqt#414.
* Handle command line arguments with QCommandLineParser instead of using glib. Requires Qt >= 5.2.
* Add Russian translation
* Drop Qt4 support in code
* Clean up CMakeLists.txt and drop Qt4 support
* New files added from LXDE Pootle server based on templates
0.8.0 / 2014-09-28
==================
* Commit from LXDE Pootle server by user Julius22.: 1007 of 1008 strings translated (2 need review).
* Commit from LXDE Pootle server by user Julius22.: 709 of 1008 strings translated (2 need review).
* Commit from LXDE Pootle server by user mbouzada.: 1008 of 1008 strings translated (0 need review).
* Commit from LXDE Pootle server by user mbouzada.: 891 of 1008 strings translated (0 need review).
* Commit from LXDE Pootle server by user mbouzada.: 615 of 1008 strings translated (0 need review).
* Commit from LXDE Pootle server by user mbouzada.: 364 of 364 strings translated (0 need review).
* New files added from LXDE Pootle server based on templates
* Keep CMAKE_CXX_FLAGS value
* Update ts files.
* Add manpage for pcmanfm-qt
* Add cs_CZ translation for libfm-qt.
* Commit from LXDE Pootle server by user dforsi.: 520 of 644 strings translated (0 need review).
* Commit from LXDE Pootle server by user dforsi.: 364 of 364 strings translated (0 need review).
* Commit from LXDE Pootle server by user dforsi.: 358 of 364 strings translated (0 need review).
* Change version number to 0.8 and update the info in the about dialog.
* Ensure that Qt 5.1 and above is used when built with Qt5 support.
* Bump package version number and library soversion to prepare for 0.2 release.
* queue relayout of desktop items when the desktop window is resized.
* Add cs_CZ translation for pcmanfm-qt.
* Fix broken Qt4 build.
* Fix bugs in multihead support and also add workaround for Qt5 bug #40681. * Handle switches between virtual desktop mode and non-virtual mode correctly. * Disable desktop wallpaper cache for non-primary screens.
* Correctly reposition desktop items when the icon size, font, or Qt style is changed.
* Slight improvement of the preference dialog for the newly added "remember window size" option.
* Fix #85 - Scrolling doesn't work in compact view.
* Hide UI elements that are not usable and disable trash can when gvfs is not available. * Add new API Fm::isUriSchemeSupported().
* Avoid showing the popup menu when moving desktop items.
* Improve handling of file selection and fixing FolderView::selectAll(), which is reported in #45. Delay the handling of selectionChanged() signal to avoid too frequent UI updates.
* Little adjustment for the grid of the folder view to decrease unnecessary margins.
* Use a new way to optimize the size of filename display based on current view mode and font size. This also fixes lxde/lxde-qt #198 - PCmanFM-qt incorrectly displays 256x256 Thumbnails.
* Replace the very broken QDesktopWidget with QScreen in Qt 5 when handling multihead support.
* Fully support single click activation and auto-selection with associated options added to the preference dialog.
* Add single click and auto-selection on hover support to Fm::FolderView.
* Re-layout desktop icons properly on QEvent::StyleChange and QEvent::FontChange.
* Try to support multihead setup in virtual screen mode (used by XRandR).
* Handle QEvent::WinIdChange event and reset X11 window properties correctly.
* New files added from LXDE Pootle server based on templates
* New files added from LXDE Pootle server based on templates
* Support forced deletion of files which bypasses the trash can with "Shift+Delete" shortcut key. * Simplify shortcut setup code a little.
* Add proper keyboard shortcuts to the desktop window. This closes bug #67.
* Add an option to go to home directory when the currently shown folder is deleted or unmounted.
* Improve update of translations to avoid unnecessary regeneration of ts files.
* Improve handling of fallback icons. This closes bug #57.
* Fix the mark for current history item in the popup menu of forward and backward buttons.
* Translations are lost accidentally in a previous commit. Restore them all.
* Add a workaround for Qt bug 32567 which causes bug #251 of lxde/lxde-qt. Now the desktop window should monitor the change of work area correctly.
* Avoid ambiguity when including path.h from libfm-qt.
* Fix a crash in Fm::PlacesModel when gvfs is not available. This closes bug #35 - Ctrl+W closes all windows.
* Fix a memory leak and free the file info list properly when renaming files.
* Do not detect filename extension and select the whole filename by default while renaming directories. This closes bug #71 - Don't try to detect extensions on directories. * API changed: Fm::renameFile() now accepect FmFileInfo as its first parameter.
* Show browse history in the context menu of back and forward tool buttons.
* Remove an unnecessary slot.
* Backspace to go up
* Fix bug #80 - make execute in context menu doesn't do change permissions.
* Remove unnecessary matrix set on the background brush.
* Avoid unnecessary writes to the desktop icon config file.
* Revert "fixed selection issue #45" This patch breaks copying files by DND in icon view mode and moving desktop icons.
* Avoid unnecessary relayout.
* Fix lxde/lxde-qt #184 - cannot move icons on desktop.
* Support showing the desktop menu provided by the window manager.
* Use qss instead of QPalette to set the background color of ColorButton. This fixed bug #192 of lxde-qt.
* Adds option to remember last window size
* Replace hard-coded version number 0x050000 with QT_VERSION_CHECK(5, 0, 0) for better readability.
* Rename the library from libfm-qt to libfm-qt5 when built with Qt5.
* fixed selection issue #45
* Make settings of size of icons be properly loaded
* Makes the "Show Hidden" option be saved in settings file and properly loaded. I don't understand why it was not done yet, bu here it is.
* Close tabs by middle click
* Fix middle click position calculation in detailed view mode
* Fix crash when context menu is requested but selection is empty
* Activate view items only if clicked with left mouse button
* Do not emit activated signal when keyboard modifiers are on.
* Splits the checks for needed libraries
* Removes duplicated include_directories() entry
* Replaces ${CMAKE_SOURCE_DIR} by ${PROJECT_SOURCE_DIR}
* Fix LICENSE. It's GPL2. Oops.
* Make sure clang compiler does not complain
* Clean up desktop files
* Install pkgconfig file of libfm-qt to correct location in FreeBSD
* Fix missing return values in several methods.
0.7.0 / 2014-05-07
==================
* Update README
* Avoid endless popups of error dialogs when there are errors launching files.
* Fix encoding handling of filenames passed via command line arguments.
* Save thumbnails as png files correctly.
0.6.99 / 2014-04-29
===================
* Update AUTHORS and COPYING
* Cached the scaled version of the wallpaper as needed to speed up program startup.
* Correctly relayout items when the work area is changed
* Adjust size of the preference dialog
* Remember custom positions for desktop icons and fix #29.
* Use new FmTerminal APIs provided by libfm. Also fix #31.
* Add template support to the folder context menus and fix #39.
* Show "owner" in the detailed list view mode. * Fix a crash when switching to detailed list mode in qt5.
* Use xcb to set EWMH window type hint to the desktop window in Qt5. * Some more cleanup for the CMakeList.txt files
* Add initial support for Qt5.
* Try to fix #36 again.
* Fix a seg fault caused by the widget being deleted during glib signal handling.
* Code cleanup, removing unnecessary header inclusion to speed up compilation.
* Avoid further handling of MountOperation in the gio finished callback if the object is deleted.
* Last fix for #36 is incorrect. Fix it again.
* Delete the tab if the folder currently being shown is deleted or unmounted.
* Use modeless dialogs for app chooser and error reporting in Fm::FileLauncher and Fm::FileMenu.
* Add an small emblem for symlinks (using icon name "emblem-symbolic-link"). Fix bug #27.
* Add missing file to git.
* Move internal implementation details to private headers which are not installed to the system.
* Add Doxygen support for API doc generation.
* Fix a regression bug, hiding "Open with..." sub menu of Fm::FileMenu for selected folders.
* Implement Fm::AppChooserDialog and Fm::AppMenuView classes. * Add <Open with...>/<Other Applications> menu item to Fm::FileMenu. * Add custom app to Fm::AppChooserComboBox.
* Add Fm::AppChooserComboBox and use it in Fm::FilePropsDialog.
* Redesign Fm::FileLauncher APIs to make it more usable. * Add Fm::FileMenu::setFileLauncher() and Fm::FolderView::setFileLauncher() APIs. * Move PCManFM::View::onFileClick() and other popup menu handling to Fm::FolderView.
* Improve Fm::FileLaucher to make it easy to derive subclasses. * Implement a special dialog for opening executable files (Fix bug #13 - it does not launch executables)
* Fix bug #28 - Tash can icon does not refresh when the trash can changes its empty/full status
* Load autocompletion list for Fm::PathEdit only when the widget has the keyboard focus to avoid unnecessary I/O.
* Add proper popup menu items for selected folders and fix #20 and #19. * Some code refactors, adding openFolders() and openFolderInTerminal() to Application class.
* Fix #25 - Amount of items in the folder is not refreshed when the folder content changes. * Update status bar text properly on switching tab pages, selection changes, and folder content changes.
* Fix the broken compiler definitions caused by previous commit.
* Fix bug #22 - Do not select file extension by default on file rename. * Avoid installing private headers (*_p.h files)
* Setup pcmanfm-qt to support optional Custom Actions Menubar detects if libfm was built with vala or not if so a fm-actions.h will exist and support will be compiled in if not, will still compile with no actions menu
* Don't append library suffix to library install path, but use it by default
* Allow installation path configuration with standard CMake X_INSTALL_DIR
* Support reordering bookmark items in the places view with DND.
* Support adding bookmarks to the places view using drag and drop
* Preparing for implementing dnd for places view.
* Improve the usability of icon view mode, fixing github bug #24.
* Fix crashes caused by invalid pointer access.
* Switch current dir of the folder view correctly with dir tree view in the side pane.
* Finish chdir operation for Fm::DirTreeView.
* Support hiding hidden folders from DirTreeModel.
* Move some methods from DirTreeModel to DirTreeModelItem and fix some row updating problems.
* Implement dynamic folder loading/unloading when expanding or collapsing dir tree nodes. * Enable horizontal scrollbar of dir tree view.
* Move some code from Fm::DirTreeModel to Fm::DirTreeModelItem.
* Partially implement Fm::DirTreeView and Fm::DirTreeModel. (not finished yet)
* Fix an invalid pointer
* Implment different modes for Fm::SidePane, matching libfm-qtk design. * Add basic skeleton for dir tree view/model.
* Fix the cosmetic defect introduced by the eject buttons in the places view.
* Add eject buttons to mounted volumes in the places side pane.
* Fix #18 New windows should always show up in front.
* Fix #18 New windows should always show up in front.
* Remove x-directory/normal, close github bug #6 and #17.
* Add a wrapper class Fm::Path for FmPath C struct.
* Do not emit StyleChange events if the icon theme is not really changed.
* Initialize icon_ member of PlacesModelItem correctly.
* Fix fallback icon when a platform plugin is abscent. * Make Fm::IconTheme::checkUpdate() a static function.
* Remove xsettings support. Use a cleaner way to detect config changes by monitor StyleChange events. * Add Fm::IconTheme::changed() signal which is emitted when the icon theme name is changed. * Replace nested Fm::PlacesModel::Item and related classes with their own separate toplevel classes.
* Fix the icon for files of unknown mime types, again.
* Fix the icon for files of unknown mime types.
* Add DES-EMA custom actions to the popup menus.
* Make it safe to create multiple Fm::LibFmQt objects and only initialize libfm once.
* Fix incorrect export symbols and use GNUInstallDirs for installation destination
* Correctly save new wallpaper config.
* Support changing wallpaper from command line & dbus.
* Read fallback default settings from /etc/xdg/pcmanfm-qt.
* Use the latest libfm thumbnailer APIs.
* Fix #3614873 - Thumbnails in icon view shown upside down for some jpegs.
* Adopt recent changes of libfm. FmIcon is essentially identical to GIcon now.
* Add a UI file for application chooser dialog.
* Correctly handle display names of folders in path entry auto-completion.
* Add a global header and add proper definition for LIBFM_QT_API macro.
* Put cmake_minimum_required(VERSION 2.8.6) at the right place.
* Add "Empty trash" and fix a memory leak.
* Fix persistent busy cursor when loading menu://applications/
* Fix memory leaks for bookmarks. Fix the broken "Network" item in places.
* Select correct folder view mode in the preference dialog.
* Reduce memory usage: Paint the folder items with our own code instead of using a dirty hacks duplicating pixmaps.
* Reduce of size of QPixmapCache in the hope of decreasing memory usage.
* Add fallback icons for places item "applications" and "network".
* Paint the background of the whole desktop window with wallpaper, including the reserved spaces.
* Set workare with QSS does not work properly. Revert the change.
* Add class Fm::CachedFolderModel, a convinient way to share Fm::FolderModel objects and reduce memory usage.
* Resize the columns of detailed list view when items are inserted or removed.
* Optimize column widths in detailed list mode when the view is resized.
* Resize the left list widget in the preference dialog according to its content.
* Detect icon theme name automatically using Xsettings or other desktop-specific way. * Rename "IconThemeName" key in the config file to "FallbackIconThemeName". * Hide the icon theme selection combo box if an icon theme name is detected automatically.
* Only show thumbnails for the first column in detailed list mode.
* Use new "automoc" feature of cmake 2.8.6 and remove cumbersome #include "*.moc" code.
* Fix work area problems of desktop window.
* Trivial fix.
* Add additional custom filter support to ProxyFolderModel.
* Add some keyboard shortcuts to the main window
* Fix some memory leaks.
* Fix some compiler errors and update translations.
* Support the latest libfm trunk. Remove -fpermissive compiler flag and fix compiler errors/warnings.
* Adopt new libfm thumbnail APIs.
* Enable thumbnail related settings.
* Adopt the latest thumbnail API in libfm (thumbnail branch) to speed up loading.
* Workardound incorrect thumbnail painting caused by bug of QStyledItemDelegate. :-(
* Fix a crash caused by accessing data for invalid model index.
* Add basic thumbnail support (need the latest thumbnail branch of libfm).
0.1 / 2013-03-26
================
* Add soname 0.0.0 for libfm-qt, preparing for 0.1 release.
* Fix crashes caused by incorrect deletion of dialog objects.
* Update zh_TW translations and translation templates.
* Add Portuguese translation (pt).
* Add Lithuanian translation (lt_LT).
* Fix a crash caused by accessing data for invalid model index.
* Add a Qt designer ui file for "Find Files" utility (not yet implemented).
* Add archiver integration for file context menus.
* Add archiver integration to file context menus.
* Add mnemonics for menu items. Make confirm dialog before delete and trash can optional.
* Update side pane according to current dir. Little fix.
* Implement "Open in Terminal" and "Open as Root".
* Enable auto-run related options in preferences dialog.
* Implement "Auto Run" for newly inserted removable devices.
* Add "Edit Bookmarks" dialog.
* Implement "Invert Selection". Little fix of UI, add a Tool menu to main window.
* Implement "Create New" menu in the folder popup menu.
* Modify make rules for translations. Avoid deleting generated ts files when "make clean". Fix a small error in zh_TW translation.
* Add auto-completion to path entry bar.
* Rename Fm::Application to Fm::LibFmQt to decrease confusion. Set required Qt version to 4.6.
* Load translation files correctly for pcmanfm-qt and libfm-qt.
* Add basic skeleton for i18n (using Qt QTranslator & Qt Linguist).
* Add separate CMakeLists.txt files for pcmanfm and libfm-qt. Hide more implementation details from libfm-qt headers.
* Fix copyright notice in all source files.
* Install desktop entry files for pcmanfm-qt & its desktop preferences dialog.
* Install a pkgconfig file for libfm-qt for use in other projects.
* Fix typos causing crashes.
* Fix a memory error caused by incorrect array size. Fix incorrect spacing of icons.
* Finish chown and chmod supports.
* Try to add file opermission settings UI.
* Implement very basic drag and drop support.
* Supress the incorrect default dnd handling of QListView.
* Try to implement Dnd.
* Make desktop preferences accessible from popup menu of desktop window.
* Convert enum values to/from strings for saving/loading config files.
* Finish desktop preferences.
* Improve desktop preferences and apply settings (partially done).
* Add desktop preferences dialog.
* Apply side pane icon size correctly. Add basic skeleton for archiver integration.
* Set shortcuts for frequently used menu options. Implement "rename file" support. Hide tabs when there is only one tab left (optional).
* Delete windows properly when they're closed with setAttribute(Qt::WA_DeleteOnClose); Apply settings to windows after clicking OK in the preference dialog.
* Improve preferences dialog. Improve loading/saving of config file.
* Improve preferences dialog. Change base class of SidePane to QWidget.
* Add basic skeleton of preferences dialog options.
* Add -fno-exceptions to compiler flags.
* Fix a crash during updating View menu.
* Sync the state of folder popup menu and main menu bar.
* Implement sort options for main window.
* Fix file sorting options for Fm::FolderMenu.
* Correctly implement browse history and fix crashes.
* Add very simple browse history (back/forward) handling.
* Apply gcc visiblility attributes to export less symbols.
* Correctly handle file rename/overwrite during file operations.
* Exclude unnecessary files from CPack.
* Add COPYING, AUTHORS, and README and add basic CPack support.
* Build libfm-qt as a separate shared library and install haeder files.
* Little fix for desktop item text shadow.
* Add DesktopItemDelegate to draw better desktop icons.
* Add code used to draw desktop wallpapers.
* Improve folder popup menu.
* Add folder popup menu. Some UI polishing.
* Fix a little crash.
* Fix crashes when turning off desktop manager.
* Show popup menu for blank area of folders.
* Do some refactor to make Fm::FolderView cleaner. Add PCManFM::View to do file manager-specific operations.
* Add desktopManagerEnabled dbus property. Little fix for command line descriptions.
* Little fix.
* Little fix for translatable strings.
* Improve desktop management support (wallpaper & icons).
* Replace QCommandLine with glib GOptionContext for command line parsing. * Improve IPC.
* Add command line parsing and basic IPC via dbus.
* Try to use QCommandLine for command line parsing.
* Move application initialization code to PCManFM::Applicaion class.
* Move files for libfm-qt and pcmanfm-qt to separate subdirs.
* Implement cut and copy files to clipboard.
* Add a item delegate to overriding the incredibly small width of text label. Special thanks to razor-qt developers for the hint!
* Make Settings class more complete, add getters and setters.
* Trivial fix.
* Add PCManFM::Settings class for config file loading/saving. Enable dragging of items in Fm::Folderview (Dnd does not fully work yet).
* Add missing files again.
* Add missing files.
* Add the basic skeleton of "ask for rename or overwrite" dialog.
* Polishing file operation dialogs.
* Add a very primitive desktop icons window implementation.
* Add basic skeleton for preferences dialog.
* Put PCManFM specific classes under new namespace PCManFM.
* Implement very primitive and basic file operations and partial clipboard support.
* Fix bugs in Fm::FileLauncher (should not free string returned by DisplayString()).
* Add a combobox to file properties dialog to select default application.
* Implement context menu for places view to remove bookmarks and unmount volumes. Little fixes for mount operation.
* Fully implement GUI for GMountOperation.
* Implement Qt-based GUI for GMountOperation.
* Improve icon theme handling.
* Implement bookmarks menu.
* Update PlacesModel when volumes/mounts/bookmarks change.
* Improve volume mounting APIs.
* Improve internal implementation of Fm::PlacesModel. Add skelaton of file operation progress dialog.
* Handle file selection correctly.
* Improve the file properties dialog.
* Add primitive implementation of properties dialog. * Some UI polishing.
* Use Fm::ProxyFolderModel to do filter and sorting. * Little fix for Fm::IconTheme and Fm::PlacesView/Model.
* Rework Fm::IconTheme, replacing QPixmap with QIcon. Improve Fm::ProxyFolderModel and use it to implement showHidden().
* Add a more professional about dialog.
* Little fix to ensure glib/GObject and libfm are correctly initialized.
* Use QTabBar + QStackedWidget to replace QTabWidget so we can share the same side pane among all tab pages.
* Slightly improve places view/model.
* Rename to pcmanfm-qt. * Implement tabbed-browsing. * Implement basic skeleton of GMountOperation. * Implement basic skeleton of Fm::PlacesView.
* Handle "returnPressed()" of the path entry.
* Use both of QListView and QTreeView to implement Fm::FolderView.
* Initial import, an attempt to create qt4 support for libfm.

@ -8,7 +8,7 @@ endif (POLICY CMP0063)
set(PCMANFM_QT_VERSION_MAJOR 0) set(PCMANFM_QT_VERSION_MAJOR 0)
set(PCMANFM_QT_VERSION_MINOR 11) set(PCMANFM_QT_VERSION_MINOR 11)
set(PCMANFM_QT_VERSION_PATCH 0) set(PCMANFM_QT_VERSION_PATCH 1)
set(PCMANFM_QT_VERSION ${PCMANFM_QT_VERSION_MAJOR}.${PCMANFM_QT_VERSION_MINOR}.${PCMANFM_QT_VERSION_PATCH}) set(PCMANFM_QT_VERSION ${PCMANFM_QT_VERSION_MAJOR}.${PCMANFM_QT_VERSION_MINOR}.${PCMANFM_QT_VERSION_PATCH})
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
@ -18,6 +18,8 @@ find_package(Qt5DBus 5.2 REQUIRED)
find_package(Qt5LinguistTools 5.2 REQUIRED) find_package(Qt5LinguistTools 5.2 REQUIRED)
find_package(Qt5X11Extras 5.2 REQUIRED) find_package(Qt5X11Extras 5.2 REQUIRED)
find_package(fm-qt REQUIRED) find_package(fm-qt REQUIRED)
#Note: no run-time dependency on liblxqt, just a build dependency for lxqt_translate_ts/desktop
find_package(lxqt REQUIRED)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(LIB_XCB REQUIRED xcb) pkg_check_modules(LIB_XCB REQUIRED xcb)
@ -26,33 +28,7 @@ option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" O
include(GNUInstallDirs) include(GNUInstallDirs)
include(LXQtTranslateTs) include(LXQtTranslateTs)
include(LXQtTranslateDesktop) include(LXQtTranslateDesktop)
include(LXQtCompilerSettings NO_POLICY_SCOPE)
# set visibility to hidden to hide symbols, unless they're exported manually in the code
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
if (CMAKE_VERSION VERSION_LESS "3.1")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
# -std=c++0x is deprecated but some tools e.g. qmake or older gcc are still using it
if(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} does not support c++11/c++0x")
endif()
endif()
else()
set(CMAKE_CXX_STANDARD 11)
endif()
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# set visibility to hidden to hide symbols, unless they're exported manually in the code
set(CMAKE_CXX_FLAGS "-fno-exceptions ${CMAKE_CXX_FLAGS}")
endif()
set(CMAKE_AUTOMOC TRUE) set(CMAKE_AUTOMOC TRUE)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)

@ -1,20 +1,39 @@
# PCManFM-Qt # PCManFM-Qt
The Qt port of the LXDE file manager PCManFM. ## Overview
Issue tracker: PCManFM-Qt is the Qt port of PCManFM, the file manager of [LXDE](http://lxde.org).
https://github.com/lxde/pcmanfm-qt/issues
LXQt website: In LXQt sessions it is in addition used to handle the desktop. Nevertheless it can be used independently of LXQt as well.
http://lxqt.org
LXDE website: PCManFM-Qt is licensed under the terms of the [GPLv2](https://www.gnu.org/licenses/gpl-2.0.en.html) or any later version. See file LICENSE for its full text.
http://lxde.org
## Installation
# License ### Compiling source code
PCManFM is licensed under the terms of the Runtime dependencies are qtx11extras, lxmenu-data, [liblxqt](https://github.com/lxde/liblxqt) and [libfm-qt](https://github.com/lxde/libfm-qt).
[GPLv2](https://www.gnu.org/licenses/gpl-2.0.en.html) or any later version. Additional build dependencies are CMake and optionally Git to pull latest VCS checkouts. The localization files were outsourced to repository [lxqt-l10n](https://github.com/lxde/lxqt-l10n) so the corresponding dependencies are needed, too. Please refer to this repository's `README.md` for further information.
See the LICENSE file for the full text of the license. Code configuration is handled by CMake. CMake variable `CMAKE_INSTALL_PREFIX` has to be set to `/usr` on most operating systems, depending on the way library paths are dealt with on 64bit systems variables like `CMAKE_INSTALL_LIBDIR` may have to be set as well.
To build run `make`, to install `make install` which accepts variable `DESTDIR` as usual.
### Binary packages
Official binary packages are available in Arch Linux, Debian (as of Debian stretch), Fedora (version 0.10.0 only so far) and openSUSE (Leap 42.1 and Tumbleweed).
## Usage
The file manager functionality should be self-explanatory, handling of the desktop deserves some notes:
To handle the desktop binary `pcmanfm-qt` has to be launched with switch `--desktop` set. Optionally switch `--profile` can be used to safe settings specific to certain session types like the different desktop environments.
In LXQt sessions, PCManFM-Qt is launched with theses switches set as [LXQt Module](https://github.com/lxde/lxqt-session#lxqt-modules).
To configure the desktop there's a dialogue "Desktop Preferences". Technically it corresponds with launching `pcmanfm-qt` with switch `--desktop-pref` set. It is available in the desktop's context menu and included as topic "Desktop" in sub-menu Preferences - LXQt settings of the panel's main menu as well as the [Configuration Center](https://github.com/lxde/lxqt-config#configuration-center) of lxqt-config.
All switches (command line options) mentioned above are explained in detail in `man 1 pcmanfm-qt`.
## Development
Issues should go to the tracker of PCManFM-Qt at https://github.com/lxde/pcmanfm-qt/issues.

@ -1,107 +0,0 @@
#=============================================================================
# The lxqt_translate_desktop() function was copied from the the
# LXQt LxQtTranste.cmake
#
# Original Author: Alexander Sokolov <sokoloff.a@gmail.com>
#
# funtion lxqt_translate_desktop(_RESULT
# SOURCES <sources>
# [TRANSLATION_DIR] translation_directory
# )
# Output:
# _RESULT The generated .desktop (.desktop) files
#
# Input:
#
# SOURCES List of input desktop files (.destktop.in) to be translated
# (merged), relative to the CMakeList.txt.
#
# TRANSLATION_DIR Optional path to the directory with the .ts files,
# relative to the CMakeList.txt. Defaults to
# "translations".
#
#=============================================================================
function(lxqt_translate_desktop _RESULT)
# Parse arguments ***************************************
set(oneValueArgs TRANSLATION_DIR)
set(multiValueArgs SOURCES)
cmake_parse_arguments(_ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# check for unknown arguments
set(_UNPARSED_ARGS ${_ARGS_UNPARSED_ARGUMENTS})
if (NOT ${_UNPARSED_ARGS} STREQUAL "")
MESSAGE(FATAL_ERROR
"Unknown arguments '${_UNPARSED_ARGS}'.\n"
"See lxqt_translate_desktop() documenation for more information.\n"
)
endif()
if (NOT DEFINED _ARGS_SOURCES)
set(${_RESULT} "" PARENT_SCOPE)
return()
else()
set(_sources ${_ARGS_SOURCES})
endif()
if (NOT DEFINED _ARGS_TRANSLATION_DIR)
set(_translationDir "translations")
else()
set(_translationDir ${_ARGS_TRANSLATION_DIR})
endif()
get_filename_component (_translationDir ${_translationDir} ABSOLUTE)
foreach (_inFile ${_sources})
get_filename_component(_inFile ${_inFile} ABSOLUTE)
get_filename_component(_fileName ${_inFile} NAME_WE)
#Extract the real extension ............
get_filename_component(_fileExt ${_inFile} EXT)
string(REPLACE ".in" "" _fileExt ${_fileExt})
#.......................................
set(_outFile "${CMAKE_CURRENT_BINARY_DIR}/${_fileName}${_fileExt}")
file(GLOB _translations
${_translationDir}/${_fileName}_*${_fileExt}
${_translationDir}/local/${_fileName}_*${_fileExt}
)
set(_pattern "'\\[.*]\\s*='")
if (_translations)
add_custom_command(OUTPUT ${_outFile}
COMMAND grep -a -v "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
COMMAND grep -a -h ${_pattern} ${_translations} >> ${_outFile}
COMMENT "Generating ${_fileName}${_fileExt}"
)
else()
add_custom_command(OUTPUT ${_outFile}
COMMAND grep -a -v "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
COMMENT "Generating ${_fileName}${_fileExt}"
)
endif()
set(__result ${__result} ${_outFile})
# TX file ***********************************************
set(_txFile "${CMAKE_BINARY_DIR}/tx/${_fileName}${_fileExt}.tx.sh")
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" _tx_translationDir ${_translationDir})
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" _tx_inFile ${_inFile})
string(REPLACE "." "" _fileType ${_fileExt})
file(WRITE ${_txFile}
"[ -f ${_inFile} ] || exit 0\n"
"echo '[lxde-qt.${_fileName}_${_fileType}]'\n"
"echo 'type = DESKTOP'\n"
"echo 'source_lang = en'\n"
"echo 'source_file = ${_tx_inFile}'\n"
"echo 'file_filter = ${_tx_translationDir}/${_fileName}_<lang>${_fileExt}'\n"
"echo ''\n"
)
endforeach()
set(${_RESULT} ${__result} PARENT_SCOPE)
endfunction(lxqt_translate_desktop)

@ -1,131 +0,0 @@
#=============================================================================
# Copyright 2014 Luís Pereira <luis.artur.pereira@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
#
# funtion lxqt_translate_ts(qmFiles
# [USE_QT5 [Yes | No]]
# [UPDATE_TRANSLATIONS [Yes | No]]
# SOURCES <sources>
# [TEMPLATE] translation_template
# [TRANSLATION_DIR] translation_directory
# [INSTALL_DIR] install_directory
# )
# Output:
# qmFiles The generated compiled translations (.qm) files
#
# Input:
# USE_QT5 Optional flag to choose between Qt4 and Qt5. Defaults to Qt5
#
# UPDATE_TRANSLATIONS Optional flag. Setting it to Yes, extracts and
# compiles the translations. Setting it No, only
# compiles them.
#
# TEMPLATE Optional translations files base name. Defaults to
# ${PROJECT_NAME}. An .ts extensions is added.
#
# TRANSLATION_DIR Optional path to the directory with the .ts files,
# relative to the CMakeList.txt. Defaults to
# "translations".
#
# INSTALL_DIR Optional destination of the file compiled files (qmFiles).
# If not present no installation is performed
# CMake v2.8.3 needed to use the CMakeParseArguments module
cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
# We use our patched version to round a annoying bug.
include(Qt5PatchedLinguistToolsMacros)
function(lxqt_translate_ts qmFiles)
set(oneValueArgs USE_QT5 UPDATE_TRANSLATIONS TEMPLATE TRANSLATION_DIR INSTALL_DIR)
set(multiValueArgs SOURCES)
cmake_parse_arguments(TR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT DEFINED TR_UPDATE_TRANSLATIONS)
set(TR_UPDATE_TRANSLATIONS "No")
endif()
if (NOT DEFINED TR_USE_QT5)
set(TR_USE_QT5 "Yes")
endif()
if(NOT DEFINED TR_TEMPLATE)
set(TR_TEMPLATE "${PROJECT_NAME}")
endif()
if (NOT DEFINED TR_TRANSLATION_DIR)
set(TR_TRANSLATION_DIR "translations")
endif()
file(GLOB tsFiles "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}_*.ts")
set(templateFile "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}.ts")
if(TR_USE_QT5)
# Qt5
if (TR_UPDATE_TRANSLATIONS)
qt5_patched_create_translation(QMS
${TR_SOURCES}
${templateFile}
OPTIONS -locations absolute
)
qt5_patched_create_translation(QM
${TR_SOURCES}
${tsFiles}
OPTIONS -locations absolute
)
else()
qt5_patched_add_translation(QM ${tsFiles})
endif()
else()
# Qt4
if(TR_UPDATE_TRANSLATIONS)
qt4_create_translation(QMS
${TR_SOURCES}
${templateFile}
OPTIONS -locations absolute
)
qt4_create_translation(QM
${TR_SOURCES}
${tsFiles}
OPTIONS -locations absolute
)
else()
qt4_add_translation(QM ${tsFiles})
endif()
endif()
if(TR_UPDATE_TRANSLATIONS)
add_custom_target("update_${TR_TEMPLATE}_ts" ALL DEPENDS ${QMS})
endif()
if(DEFINED TR_INSTALL_DIR)
install(FILES ${QM} DESTINATION ${TR_INSTALL_DIR})
endif()
set(${qmFiles} ${QM} PARENT_SCOPE)
endfunction()

@ -1,112 +0,0 @@
#=============================================================================
# Copyright 2005-2011 Kitware, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of Kitware, Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
include(CMakeParseArguments)
function(QT5_PATCHED_CREATE_TRANSLATION _qm_files)
set(options)
set(oneValueArgs)
set(multiValueArgs OPTIONS)
cmake_parse_arguments(_LUPDATE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(_lupdate_files ${_LUPDATE_UNPARSED_ARGUMENTS})
set(_lupdate_options ${_LUPDATE_OPTIONS})
set(_my_sources)
set(_my_tsfiles)
foreach(_file ${_lupdate_files})
get_filename_component(_ext ${_file} EXT)
get_filename_component(_abs_FILE ${_file} ABSOLUTE)
if(_ext MATCHES "ts")
list(APPEND _my_tsfiles ${_abs_FILE})
else()
list(APPEND _my_sources ${_abs_FILE})
endif()
endforeach()
foreach(_ts_file ${_my_tsfiles})
if(_my_sources)
# make a list file to call lupdate on, so we don't make our commands too
# long for some systems
# get_filename_component(_ts_name ${_ts_file} NAME_WE)
get_filename_component(_name ${_ts_file} NAME)
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _ts_name ${_name})
set(_ts_lst_file "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lst_file")
set(_lst_file_srcs)
foreach(_lst_file_src ${_my_sources})
set(_lst_file_srcs "${_lst_file_src}\n${_lst_file_srcs}")
endforeach()
get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES)
foreach(_pro_include ${_inc_DIRS})
get_filename_component(_abs_include "${_pro_include}" ABSOLUTE)
set(_lst_file_srcs "-I${_pro_include}\n${_lst_file_srcs}")
endforeach()
file(WRITE ${_ts_lst_file} "${_lst_file_srcs}")
endif()
add_custom_command(OUTPUT ${_ts_file}
COMMAND ${Qt5_LUPDATE_EXECUTABLE}
ARGS ${_lupdate_options} "@${_ts_lst_file}" -ts ${_ts_file}
DEPENDS ${_my_sources} ${_ts_lst_file} VERBATIM)
endforeach()
qt5_patched_add_translation(${_qm_files} ${_my_tsfiles})
set(${_qm_files} ${${_qm_files}} PARENT_SCOPE)
endfunction()
function(QT5_PATCHED_ADD_TRANSLATION _qm_files)
foreach(_current_FILE ${ARGN})
get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
# get_filename_component(qm ${_abs_FILE} NAME_WE)
get_filename_component(_name ${_abs_FILE} NAME)
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" qm ${_name})
get_source_file_property(output_location ${_abs_FILE} OUTPUT_LOCATION)
if(output_location)
file(MAKE_DIRECTORY "${output_location}")
set(qm "${output_location}/${qm}.qm")
else()
set(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm")
endif()
add_custom_command(OUTPUT ${qm}
COMMAND ${Qt5_LRELEASE_EXECUTABLE}
ARGS ${_abs_FILE} -qm ${qm}
DEPENDS ${_abs_FILE} VERBATIM
)
list(APPEND ${_qm_files} ${qm})
endforeach()
set(${_qm_files} ${${_qm_files}} PARENT_SCOPE)
endfunction()

3
debian/.gitignore vendored

@ -1,12 +1,11 @@
/*.debhelper /*.debhelper
/*.log /*.log
/*.substvars /*.substvars
/debhelper-build-stamp
/files /files
/mangled /mangled
/pcmanfm-qt/ /pcmanfm-qt/
/pcmanfm-qt-dbg/
/libfm-qt5-2/ /libfm-qt5-2/
/libfm-qt5-dev/ /libfm-qt5-dev/
/libfm-qt5-dbg/
/tmp /tmp

22
debian/changelog vendored

@ -1,3 +1,25 @@
pcmanfm-qt (0.11.1-2) unstable; urgency=medium
* Cherry-picking upstream release 0.11.1.
* Synced debian foo with experimental
* Removed --parallel from rules, standard compat 10
* New dep. default-dbus-session-bus | dbus-session-bus | dbus-x11
(Closes: #836284)
* Fixed Crashes while copying (Closes: #823753)
* Bumped minimum version libfm-qt-dev (>= 0.11.1)
* Bumped minimum version libqt5xdg-dev (>= 2.0.0)
* Added build dependency libkf5windowsystem-dev
* Added build dependency libqt5svg5-dev
* Added build dependency liblxqt0-dev (>= 0.11.0)
* Added Recommends pcmanfm-qt-l10n
* Fixed VCS fields, using plain /git/
* Fixed copyright Format field, using https
* Dropped patches, applied upstream
* Added translation controls
* Set CMAKE_BUILD_TYPE=RelWithDebInfo
-- Alf Gaida <agaida@siduction.org> Tue, 18 Oct 2016 22:59:30 +0200
pcmanfm-qt (0.11.0-10) unstable; urgency=medium pcmanfm-qt (0.11.0-10) unstable; urgency=medium
* Fixed typo in Recommends: oyxgen-icon-theme -> oxygen-icon-theme * Fixed typo in Recommends: oyxgen-icon-theme -> oxygen-icon-theme

13
debian/control vendored

@ -10,12 +10,14 @@ Priority: optional
Build-Depends: debhelper (>= 10), Build-Depends: debhelper (>= 10),
cmake (>= 3.0.2), cmake (>= 3.0.2),
libfm-dev (>= 1.2.0), libfm-dev (>= 1.2.0),
libfm-qt-dev (>= 0.11.0), libfm-qt-dev (>= 0.11.1),
libglib2.0-dev, libglib2.0-dev,
liblxqt0-dev (>= 0.10.0), libkf5windowsystem-dev,
liblxqt0-dev (>= 0.11.0),
libmenu-cache-dev, libmenu-cache-dev,
libqt5svg5-dev,
libqt5x11extras5-dev, libqt5x11extras5-dev,
libqt5xdg-dev (>= 1.3.0), libqt5xdg-dev (>= 2.0.0),
libx11-dev, libx11-dev,
pkg-config, pkg-config,
qttools5-dev, qttools5-dev,
@ -29,11 +31,12 @@ Package: pcmanfm-qt
Architecture: any Architecture: any
Depends: ${misc:Depends}, Depends: ${misc:Depends},
${shlibs:Depends}, ${shlibs:Depends},
dbus-x11, default-dbus-session-bus | dbus-session-bus | dbus-x11,
libfm-modules libfm-modules
Recommends: gvfs-backends, Recommends: gvfs-backends,
lxqt-sudo | gksu, lxqt-sudo | gksu,
breeze-icon-theme | oxygen-icon-theme | faenza-icon-theme | gnome-icon-theme breeze-icon-theme | oxygen-icon-theme | faenza-icon-theme | gnome-icon-theme,
pcmanfm-qt-l10n
Description: extremely fast and lightweight file and desktop icon manager Description: extremely fast and lightweight file and desktop icon manager
PCManFM-Qt is the Qt port of the LXDE file manager PCManFM. PCManFM-Qt is the Qt port of the LXDE file manager PCManFM.
. .

@ -1,19 +0,0 @@
Description: Set oxygen as default fallback
until the FIXME is done. That's all i want to do for now.
oxygen is merged upstream so the patch become obsolete with the
upcoming release.
Author: Alf Gaida <agaida@siduction.org>
Bug-Debian: https://bugs.debian.org/826311
Last-Update: 2016-06-04
--- pcmanfm-qt-0.11.0.orig/pcmanfm/settings.cpp
+++ pcmanfm-qt-0.11.0/pcmanfm/settings.cpp
@@ -163,7 +163,7 @@ bool Settings::loadFile(QString filePath
if(fallbackIconThemeName_.isEmpty()) {
// FIXME: we should choose one from installed icon themes or get
// the value from XSETTINGS instead of hard code a fallback value.
- fallbackIconThemeName_ = "elementary"; // fallback icon theme name
+ fallbackIconThemeName_ = "oxygen"; // fallback icon theme name
}
suCommand_ = settings.value("SuCommand", "lxqt-sudo %s").toString();
setTerminal(settings.value("Terminal", "xterm").toString());

@ -1 +0,0 @@
fallback-icon-theme.patch

5
debian/rules vendored

@ -6,9 +6,10 @@ export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%: %:
dh ${@} --buildsystem cmake\ dh ${@} --buildsystem cmake
--parallel
override_dh_auto_configure: override_dh_auto_configure:
dh_auto_configure --\ dh_auto_configure --\
-DPULL_TRANSLATIONS=OFF\
-DUPDATE_TRANSLATIONS=OFF\
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_BUILD_TYPE=RelWithDebInfo

@ -38,6 +38,11 @@ qt5_wrap_ui(pcmanfm_UIS_H ${pcmanfm_UIS})
lxqt_translate_ts(QM_FILES lxqt_translate_ts(QM_FILES
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS} UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
SOURCES ${pcmanfm_SRCS} ${pcmanfm_UIS} SOURCES ${pcmanfm_SRCS} ${pcmanfm_UIS}
INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/translations"
PULL_TRANSLATIONS ${PULL_TRANSLATIONS}
CLEAN_TRANSLATIONS ${CLEAN_TRANSLATIONS}
TRANSLATIONS_REPO ${TRANSLATIONS_REPO}
TRANSLATIONS_REFSPEC ${TRANSLATIONS_REFSPEC}
) )
# translate desktop entry files for pcmanfm-qt and desktop preferences # translate desktop entry files for pcmanfm-qt and desktop preferences
@ -79,7 +84,5 @@ install(TARGETS pcmanfm-qt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${DESKTOP_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/applications" install(FILES ${DESKTOP_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/applications"
) )
install(FILES ${QM_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/pcmanfm-qt/translations")
# prevent the generated files from being deleted during make clean # prevent the generated files from being deleted during make clean
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true) set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true)

@ -43,6 +43,8 @@
#include "autorundialog.h" #include "autorundialog.h"
#include "launcher.h" #include "launcher.h"
#include <libfm-qt/filesearchdialog.h> #include <libfm-qt/filesearchdialog.h>
#include <libfm-qt/path.h>
#include <libfm-qt/terminal.h>
#include <QScreen> #include <QScreen>
#include <QWindow> #include <QWindow>
@ -70,13 +72,13 @@ Application::Application(int& argc, char** argv):
settings_(), settings_(),
profileName_("default"), profileName_("default"),
daemonMode_(false), daemonMode_(false),
desktopWindows_(),
enableDesktopManager_(false), enableDesktopManager_(false),
desktopWindows_(),
preferencesDialog_(), preferencesDialog_(),
editBookmarksialog_(),
volumeMonitor_(NULL), volumeMonitor_(NULL),
userDirsWatcher_(NULL), userDirsWatcher_(NULL),
lxqtRunning_(false), lxqtRunning_(false) {
editBookmarksialog_() {
argc_ = argc; argc_ = argc;
argv_ = argv; argv_ = argv;
@ -352,11 +354,10 @@ void Application::onAboutToQuit() {
bool Application::eventFilter(QObject* watched, QEvent* event) { bool Application::eventFilter(QObject* watched, QEvent* event) {
if(watched == desktop()) { if(watched == desktop()) {
switch(event->type()) { if (event->type() == QEvent::StyleChange ||
case QEvent::StyleChange: event->type() == QEvent::ThemeChange) {
case QEvent::ThemeChange:
setStyle(new ProxyStyle()); setStyle(new ProxyStyle());
}; }
} }
return QObject::eventFilter(watched, event); return QObject::eventFilter(watched, event);
} }
@ -440,10 +441,9 @@ void Application::onFindFileAccepted() {
Fm::FileSearchDialog* dlg = static_cast<Fm::FileSearchDialog*>(sender()); Fm::FileSearchDialog* dlg = static_cast<Fm::FileSearchDialog*>(sender());
Fm::Path uri = dlg->searchUri(); Fm::Path uri = dlg->searchUri();
// FIXME: we should be able to open it in an existing window // FIXME: we should be able to open it in an existing window
FmPathList* paths = fm_path_list_new(); Fm::PathList paths;
fm_path_list_push_tail(paths, uri.data()); paths.pushTail(uri);
Launcher(NULL).launchPaths(NULL, paths); Launcher(NULL).launchPaths(NULL, paths);
fm_path_list_unref(paths);
} }
void Application::findFiles(QStringList paths) { void Application::findFiles(QStringList paths) {
@ -455,50 +455,46 @@ void Application::findFiles(QStringList paths) {
} }
void Application::launchFiles(QString cwd, QStringList paths, bool inNewWindow) { void Application::launchFiles(QString cwd, QStringList paths, bool inNewWindow) {
FmPathList* pathList = fm_path_list_new(); Fm::PathList pathList;
FmPath* cwd_path = NULL; Fm::Path cwd_path;
QStringList::iterator it; QStringList::iterator it;
Q_FOREACH(const QString& it, paths) { Q_FOREACH(const QString& it, paths) {
QByteArray pathName = it.toLocal8Bit(); QByteArray pathName = it.toLocal8Bit();
FmPath* path = NULL; Fm::Path path;
if(pathName[0] == '/') // absolute path if(pathName[0] == '/') // absolute path
path = fm_path_new_for_path(pathName.constData()); path = Fm::Path::newForPath(pathName.constData());
else if(pathName.contains(":/")) // URI else if(pathName.contains(":/")) // URI
path = fm_path_new_for_uri(pathName.constData()); path = Fm::Path::newForUri(pathName.constData());
else if(pathName == "~") // special case for home dir else if(pathName == "~") // special case for home dir
path = fm_path_ref(fm_path_get_home()); path = Fm::Path::getHome();
else // basename else // basename
{ {
if(Q_UNLIKELY(!cwd_path)) if(Q_UNLIKELY(!cwd_path))
cwd_path = fm_path_new_for_str(cwd.toLocal8Bit().constData()); cwd_path = Fm::Path::newForStr(cwd.toLocal8Bit().constData());
path = fm_path_new_relative(cwd_path, pathName.constData()); path = cwd_path.newRelative(pathName.constData());
} }
fm_path_list_push_tail(pathList, path); fm_path_list_push_tail(pathList, path);
fm_path_unref(path);
} }
if(cwd_path)
fm_path_unref(cwd_path);
Launcher(NULL).launchPaths(NULL, pathList); Launcher(NULL).launchPaths(NULL, pathList);
fm_path_list_unref(pathList);
} }
void Application::openFolders(FmFileInfoList* files) { void Application::openFolders(Fm::FileInfoList files) {
Launcher(NULL).launchFiles(NULL, files); Launcher(NULL).launchFiles(NULL, files);
} }
void Application::openFolderInTerminal(FmPath* path) { void Application::openFolderInTerminal(Fm::Path path) {
if(!settings_.terminal().isEmpty()) { if(!settings_.terminal().isEmpty()) {
char* cwd_str; char* cwd_str;
if(fm_path_is_native(path)) if(path.isNative())
cwd_str = fm_path_to_str(path); cwd_str = path.toStr();
else { // gio will map remote filesystems to local FUSE-mounted paths here. else { // gio will map remote filesystems to local FUSE-mounted paths here.
GFile* gf = fm_path_to_gfile(path); GFile* gf = path.toGfile();
cwd_str = g_file_get_path(gf); cwd_str = g_file_get_path(gf);
g_object_unref(gf); g_object_unref(gf);
} }
GError* err = NULL; GError* err = NULL;
if(!fm_terminal_launch(cwd_str, &err)) { if(!Fm::Terminal::launch(cwd_str, &err)) {
QMessageBox::critical(NULL, tr("Error"), QString::fromUtf8(err->message)); QMessageBox::critical(NULL, tr("Error"), QString::fromUtf8(err->message));
g_error_free(err); g_error_free(err);
} }

@ -84,8 +84,8 @@ public:
void updateFromSettings(); void updateFromSettings();
void updateDesktopsFromSettings(); void updateDesktopsFromSettings();
void openFolderInTerminal(FmPath* path); void openFolderInTerminal(Fm::Path path);
void openFolders(FmFileInfoList* files); void openFolders(Fm::FileInfoList files);
QString profileName() { QString profileName() {
return profileName_; return profileName_;

@ -27,10 +27,10 @@
namespace PCManFM { namespace PCManFM {
AutoRunDialog::AutoRunDialog(GVolume* volume, GMount* mount, QWidget* parent, Qt::WindowFlags f): AutoRunDialog::AutoRunDialog(GVolume* volume, GMount* mount, QWidget* parent, Qt::WindowFlags f):
QDialog(parent, f),
cancellable(g_cancellable_new()), cancellable(g_cancellable_new()),
applications(NULL), applications(NULL),
mount_(G_MOUNT(g_object_ref(mount))), mount_(G_MOUNT(g_object_ref(mount))) {
QDialog(parent, f) {
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
ui.setupUi(this); ui.setupUi(this);
@ -74,11 +74,10 @@ void AutoRunDialog::accept() {
// the default action, open the mounted folder in the file manager // the default action, open the mounted folder in the file manager
Application* app = static_cast<Application*>(qApp); Application* app = static_cast<Application*>(qApp);
Settings& settings = app->settings(); Settings& settings = app->settings();
FmPath* path = fm_path_new_for_gfile(gf); Fm::Path path = Fm::Path::newForGfile(gf);
// open the path in a new window // open the path in a new window
// FIXME: or should we open it in a new tab? Make this optional later // FIXME: or should we open it in a new tab? Make this optional later
MainWindow* win = new MainWindow(path); MainWindow* win = new MainWindow(path);
fm_path_unref(path);
win->resize(settings.windowWidth(), settings.windowHeight()); win->resize(settings.windowWidth(), settings.windowHeight());
if(settings.windowMaximized()) { if(settings.windowMaximized()) {
win->setWindowState(win->windowState() | Qt::WindowMaximized); win->setWindowState(win->windowState() | Qt::WindowMaximized);

@ -113,6 +113,25 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Icons</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Icon size:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="iconSize"/>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">

@ -20,6 +20,7 @@
#include "desktopitemdelegate.h" #include "desktopitemdelegate.h"
#include <libfm-qt/foldermodel.h> #include <libfm-qt/foldermodel.h>
#include <libfm-qt/fileinfo.h>
#include <QApplication> #include <QApplication>
#include <QListView> #include <QListView>
#include <QPainter> #include <QPainter>
@ -41,7 +42,7 @@ DesktopItemDelegate::DesktopItemDelegate(QListView* view, QObject* parent):
// FIXME: we need to figure out a way to derive from Fm::FolderItemDelegate to avoid code duplication. // FIXME: we need to figure out a way to derive from Fm::FolderItemDelegate to avoid code duplication.
void DesktopItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { void DesktopItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
Q_ASSERT(index.isValid()); Q_ASSERT(index.isValid());
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
painter->save(); painter->save();
@ -67,9 +68,9 @@ void DesktopItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
// draw some emblems for the item if needed // draw some emblems for the item if needed
// we only support symlink emblem at the moment // we only support symlink emblem at the moment
FmFileInfo* file = static_cast<FmFileInfo*>(index.data(Fm::FolderModel::FileInfoRole).value<void*>()); Fm::FileInfo file = static_cast<FmFileInfo*>(index.data(Fm::FolderModel::FileInfoRole).value<void*>());
if(file) { if(!file.isNull()) {
if(fm_file_info_is_symlink(file)) { if(file.isSymlink()) {
painter->drawPixmap(iconPos, symlinkIcon_.pixmap(opt.decorationSize / 2, iconMode)); painter->drawPixmap(iconPos, symlinkIcon_.pixmap(opt.decorationSize / 2, iconMode));
} }
} }
@ -88,7 +89,7 @@ void DesktopItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
painter->restore(); painter->restore();
} }
void DesktopItemDelegate::drawText(QPainter* painter, QStyleOptionViewItemV4& opt, QRectF& textRect) const { void DesktopItemDelegate::drawText(QPainter* painter, QStyleOptionViewItem& opt, QRectF& textRect) const {
QTextLayout layout(opt.text, opt.font); QTextLayout layout(opt.text, opt.font);
QTextOption textOption; QTextOption textOption;
@ -137,7 +138,7 @@ void DesktopItemDelegate::drawText(QPainter* painter, QStyleOptionViewItemV4& op
if (opt.state & QStyle::State_Selected || opt.state & QStyle::State_MouseOver) { if (opt.state & QStyle::State_Selected || opt.state & QStyle::State_MouseOver) {
if (const QWidget* widget = opt.widget) { // let the style engine do it if (const QWidget* widget = opt.widget) { // let the style engine do it
QStyle* style = widget->style() ? widget->style() : qApp->style(); QStyle* style = widget->style() ? widget->style() : qApp->style();
QStyleOptionViewItemV4 o(opt); QStyleOptionViewItem o(opt);
o.text = QString(); o.text = QString();
o.rect = selRect.toAlignedRect().intersected(opt.rect); // due to clipping and rounding, we might lose 1px o.rect = selRect.toAlignedRect().intersected(opt.rect); // due to clipping and rounding, we might lose 1px
o.showDecorationSelected = true; o.showDecorationSelected = true;
@ -185,7 +186,7 @@ QSize DesktopItemDelegate::sizeHint(const QStyleOptionViewItem& option, const QM
QVariant value = index.data(Qt::SizeHintRole); QVariant value = index.data(Qt::SizeHintRole);
if(value.isValid()) if(value.isValid())
return qvariant_cast<QSize>(value); return qvariant_cast<QSize>(value);
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
opt.decorationAlignment = Qt::AlignHCenter|Qt::AlignTop; opt.decorationAlignment = Qt::AlignHCenter|Qt::AlignTop;
opt.displayAlignment = Qt::AlignTop|Qt::AlignHCenter; opt.displayAlignment = Qt::AlignTop|Qt::AlignHCenter;

@ -50,7 +50,7 @@ public:
} }
private: private:
void drawText(QPainter* painter, QStyleOptionViewItemV4& opt, QRectF& textRect) const; void drawText(QPainter* painter, QStyleOptionViewItem& opt, QRectF& textRect) const;
private: private:
QListView* view_; QListView* view_;

@ -33,6 +33,8 @@
namespace PCManFM { namespace PCManFM {
static int iconSizes[] = {96, 72, 64, 48, 36, 32, 24, 20};
DesktopPreferencesDialog::DesktopPreferencesDialog(QWidget* parent, Qt::WindowFlags f): DesktopPreferencesDialog::DesktopPreferencesDialog(QWidget* parent, Qt::WindowFlags f):
QDialog(parent, f), QDialog(parent, f),
editDesktopFolderEnabled(false), editDesktopFolderEnabled(false),
@ -78,6 +80,13 @@ DesktopPreferencesDialog::DesktopPreferencesDialog(QWidget* parent, Qt::WindowFl
qDebug("wallpaper: %s", settings.wallpaper().toUtf8().data()); qDebug("wallpaper: %s", settings.wallpaper().toUtf8().data());
ui.imageFile->setText(settings.wallpaper()); ui.imageFile->setText(settings.wallpaper());
for(int i = 0; i < G_N_ELEMENTS(iconSizes); ++i) {
int size = iconSizes[i];
ui.iconSize->addItem(QString("%1 x %1").arg(size), size);
if(settings.desktopIconSize() == size)
ui.iconSize->setCurrentIndex(i);
}
ui.font->setFont(settings.desktopFont()); ui.font->setFont(settings.desktopFont());
ui.backgroundColor->setColor(settings.desktopBgColor()); ui.backgroundColor->setColor(settings.desktopBgColor());
@ -132,6 +141,7 @@ void DesktopPreferencesDialog::applySettings()
settings.setWallpaper(ui.imageFile->text()); settings.setWallpaper(ui.imageFile->text());
int mode = ui.wallpaperMode->itemData(ui.wallpaperMode->currentIndex()).toInt(); int mode = ui.wallpaperMode->itemData(ui.wallpaperMode->currentIndex()).toInt();
settings.setWallpaperMode(mode); settings.setWallpaperMode(mode);
settings.setDesktopIconSize(ui.iconSize->itemData(ui.iconSize->currentIndex()).toInt());
settings.setDesktopFont(ui.font->font()); settings.setDesktopFont(ui.font->font());
settings.setDesktopBgColor(ui.backgroundColor->color()); settings.setDesktopBgColor(ui.backgroundColor->color());
settings.setDesktopFgColor(ui.textColor->color()); settings.setDesktopFgColor(ui.textColor->color());

@ -48,6 +48,7 @@
#include <libfm-qt/filepropsdialog.h> #include <libfm-qt/filepropsdialog.h>
#include <libfm-qt/utilities.h> #include <libfm-qt/utilities.h>
#include <libfm-qt/path.h> #include <libfm-qt/path.h>
#include <libfm-qt/fileinfo.h>
#include "xdgdir.h" #include "xdgdir.h"
#include <QX11Info> #include <QX11Info>
@ -59,13 +60,12 @@ namespace PCManFM {
DesktopWindow::DesktopWindow(int screenNum): DesktopWindow::DesktopWindow(int screenNum):
View(Fm::FolderView::IconMode), View(Fm::FolderView::IconMode),
screenNum_(screenNum),
folder_(NULL),
model_(NULL),
proxyModel_(NULL), proxyModel_(NULL),
model_(NULL),
wallpaperMode_(WallpaperNone),
fileLauncher_(NULL), fileLauncher_(NULL),
showWmMenu_(false), showWmMenu_(false),
wallpaperMode_(WallpaperNone), screenNum_(screenNum),
relayoutTimer_(NULL) { relayoutTimer_(NULL) {
QDesktopWidget* desktopWidget = QApplication::desktop(); QDesktopWidget* desktopWidget = QApplication::desktop();
@ -90,18 +90,20 @@ DesktopWindow::DesktopWindow(int screenNum):
loadItemPositions(); loadItemPositions();
Settings& settings = static_cast<Application* >(qApp)->settings(); Settings& settings = static_cast<Application* >(qApp)->settings();
model_ = Fm::CachedFolderModel::modelFromPath(fm_path_get_desktop()); model_ = Fm::CachedFolderModel::modelFromPath(Fm::Path::getDesktop());
folder_ = reinterpret_cast<FmFolder*>(g_object_ref(model_->folder())); folder_ = model_->folder();
proxyModel_ = new Fm::ProxyFolderModel(); proxyModel_ = new Fm::ProxyFolderModel();
proxyModel_->setSourceModel(model_); proxyModel_->setSourceModel(model_);
proxyModel_->setShowThumbnails(settings.showThumbnails()); proxyModel_->setShowThumbnails(settings.showThumbnails());
proxyModel_->sort(Fm::FolderModel::ColumnFileMTime); proxyModel_->sort(settings.desktopSortColumn(), settings.desktopSortOrder());
proxyModel_->setFolderFirst(settings.desktopSortFolderFirst());
setModel(proxyModel_); setModel(proxyModel_);
connect(proxyModel_, &Fm::ProxyFolderModel::rowsInserted, this, &DesktopWindow::onRowsInserted); connect(proxyModel_, &Fm::ProxyFolderModel::rowsInserted, this, &DesktopWindow::onRowsInserted);
connect(proxyModel_, &Fm::ProxyFolderModel::rowsAboutToBeRemoved, this, &DesktopWindow::onRowsAboutToBeRemoved); connect(proxyModel_, &Fm::ProxyFolderModel::rowsAboutToBeRemoved, this, &DesktopWindow::onRowsAboutToBeRemoved);
connect(proxyModel_, &Fm::ProxyFolderModel::layoutChanged, this, &DesktopWindow::onLayoutChanged); connect(proxyModel_, &Fm::ProxyFolderModel::layoutChanged, this, &DesktopWindow::onLayoutChanged);
connect(proxyModel_, &Fm::ProxyFolderModel::sortFilterChanged, this, &DesktopWindow::onModelSortFilterChanged);
connect(listView_, &QListView::indexesMoved, this, &DesktopWindow::onIndexesMoved); connect(listView_, &QListView::indexesMoved, this, &DesktopWindow::onIndexesMoved);
} }
@ -157,9 +159,6 @@ DesktopWindow::~DesktopWindow() {
if(model_) if(model_)
model_->unref(); model_->unref();
if(folder_)
g_object_unref(folder_);
} }
void DesktopWindow::setBackground(const QColor& color) { void DesktopWindow::setBackground(const QColor& color) {
@ -199,7 +198,7 @@ void DesktopWindow::resizeEvent(QResizeEvent* event) {
} }
void DesktopWindow::setDesktopFolder() { void DesktopWindow::setDesktopFolder() {
FmPath *path = fm_path_new_for_path(XdgDir::readDesktopDir().toStdString().c_str()); Fm::Path path = Fm::Path::newForPath(XdgDir::readDesktopDir().toStdString().c_str());
model_ = Fm::CachedFolderModel::modelFromPath(path); model_ = Fm::CachedFolderModel::modelFromPath(path);
proxyModel_->setSourceModel(model_); proxyModel_->setSourceModel(model_);
} }
@ -343,7 +342,7 @@ void DesktopWindow::updateFromSettings(Settings& settings) {
setWallpaperFile(settings.wallpaper()); setWallpaperFile(settings.wallpaper());
setWallpaperMode(settings.wallpaperMode()); setWallpaperMode(settings.wallpaperMode());
setFont(settings.desktopFont()); setFont(settings.desktopFont());
setIconSize(Fm::FolderView::IconMode, QSize(settings.bigIconSize(), settings.bigIconSize())); setIconSize(Fm::FolderView::IconMode, QSize(settings.desktopIconSize(), settings.desktopIconSize()));
setMargins(settings.desktopCellMargins()); setMargins(settings.desktopCellMargins());
// setIconSize and setMargins may trigger relayout of items by QListView, so we need to do the layout again. // setIconSize and setMargins may trigger relayout of items by QListView, so we need to do the layout again.
queueRelayout(); queueRelayout();
@ -369,11 +368,11 @@ void DesktopWindow::prepareFileMenu(Fm::FileMenu* menu) {
menu->insertSeparator(menu->separator2()); menu->insertSeparator(menu->separator2());
menu->insertAction(menu->separator2(), action); menu->insertAction(menu->separator2(), action);
FmFileInfoList* files = menu->files(); Fm::FileInfoList files = menu->files();
// select exactly one item // select exactly one item
if(fm_file_info_list_get_length(files) == 1) { if(fm_file_info_list_get_length(files) == 1) {
FmFileInfo* file = menu->firstFile(); Fm::FileInfo file = menu->firstFile();
if(customItemPos_.find(fm_file_info_get_name(file)) != customItemPos_.end()) { if(customItemPos_.find(file.getName()) != customItemPos_.end()) {
// the file item has a custom position // the file item has a custom position
action->setChecked(true); action->setChecked(true);
} }
@ -407,7 +406,7 @@ void DesktopWindow::onRowsAboutToBeRemoved(const QModelIndex& parent, int start,
// Here we can't rely on ProxyFolderModel::fileInfoFromIndex() because, although rows // Here we can't rely on ProxyFolderModel::fileInfoFromIndex() because, although rows
// aren't removed yet, files are already removed. // aren't removed yet, files are already removed.
QHash<QByteArray, QPoint> _customItemPos = customItemPos_; QHash<QByteArray, QPoint> _customItemPos = customItemPos_;
char* dektopPath = fm_path_to_str(fm_path_get_desktop()); char* dektopPath = Fm::Path::getDesktop().toStr();
QString desktopDir = QString(dektopPath) + QString("/"); QString desktopDir = QString(dektopPath) + QString("/");
g_free(dektopPath); g_free(dektopPath);
QHash<QByteArray, QPoint>::iterator it; QHash<QByteArray, QPoint>::iterator it;
@ -426,6 +425,13 @@ void DesktopWindow::onLayoutChanged() {
queueRelayout(); queueRelayout();
} }
void DesktopWindow::onModelSortFilterChanged() {
Settings& settings = static_cast<Application*>(qApp)->settings();
settings.setDesktopSortColumn(static_cast<Fm::FolderModel::ColumnId>(proxyModel_->sortColumn()));
settings.setDesktopSortOrder(proxyModel_->sortOrder());
settings.setSesktopSortFolderFirst(proxyModel_->folderFirst());
}
void DesktopWindow::onIndexesMoved(const QModelIndexList& indexes) { void DesktopWindow::onIndexesMoved(const QModelIndexList& indexes) {
// remember the custom position for the items // remember the custom position for the items
Q_FOREACH(const QModelIndex& index, indexes) { Q_FOREACH(const QModelIndex& index, indexes) {
@ -435,7 +441,7 @@ void DesktopWindow::onIndexesMoved(const QModelIndexList& indexes) {
// Since we only care about rows, not individual cells, // Since we only care about rows, not individual cells,
// let's handle column 0 of every row here. // let's handle column 0 of every row here.
if(index.column() == 0) { if(index.column() == 0) {
FmFileInfo* file = proxyModel_->fileInfoFromIndex(index); Fm::FileInfo file = proxyModel_->fileInfoFromIndex(index);
QRect itemRect = listView_->rectForIndex(index); QRect itemRect = listView_->rectForIndex(index);
QPoint tl = itemRect.topLeft(); QPoint tl = itemRect.topLeft();
QRect workArea = qApp->desktop()->availableGeometry(screenNum_); QRect workArea = qApp->desktop()->availableGeometry(screenNum_);
@ -444,7 +450,7 @@ void DesktopWindow::onIndexesMoved(const QModelIndexList& indexes) {
&& tl.x() >= workArea.x() && tl.y() >= workArea.y() && tl.x() >= workArea.x() && tl.y() >= workArea.y()
&& tl.x() + listView_->gridSize().width() <= workArea.right() + 1 // for historical reasons (-> Qt doc) && tl.x() + listView_->gridSize().width() <= workArea.right() + 1 // for historical reasons (-> Qt doc)
&& tl.y() + listView_->gridSize().height() <= workArea.bottom() + 1) { // as above && tl.y() + listView_->gridSize().height() <= workArea.bottom() + 1) { // as above
QByteArray name = fm_file_info_get_name(file); QByteArray name = file.getName();
customItemPos_[name] = tl; customItemPos_[name] = tl;
// qDebug() << "indexMoved:" << name << index << itemRect; // qDebug() << "indexMoved:" << name << index << itemRect;
} }
@ -527,8 +533,8 @@ void DesktopWindow::relayoutItems() {
for(; row < rowCount; ++row) { for(; row < rowCount; ++row) {
QModelIndex index = proxyModel_->index(row, 0); QModelIndex index = proxyModel_->index(row, 0);
int itemWidth = delegate_->sizeHint(listView_->getViewOptions(), index).width(); int itemWidth = delegate_->sizeHint(listView_->getViewOptions(), index).width();
FmFileInfo* file = proxyModel_->fileInfoFromIndex(index); Fm::FileInfo file = proxyModel_->fileInfoFromIndex(index);
QByteArray name = fm_file_info_get_name(file); QByteArray name = file.getName();
QHash<QByteArray, QPoint>::iterator it = customItemPos_.find(name); QHash<QByteArray, QPoint>::iterator it = customItemPos_.find(name);
if(it != customItemPos_.end()) { // the item has a custom position if(it != customItemPos_.end()) { // the item has a custom position
QPoint customPos = *it; QPoint customPos = *it;
@ -585,7 +591,7 @@ void DesktopWindow::loadItemPositions() {
QSize grid = listView_->gridSize(); QSize grid = listView_->gridSize();
QRect workArea = qApp->desktop()->availableGeometry(screenNum_); QRect workArea = qApp->desktop()->availableGeometry(screenNum_);
workArea.adjust(12, 12, -12, -12); workArea.adjust(12, 12, -12, -12);
char* dektopPath = fm_path_to_str(fm_path_get_desktop()); char* dektopPath = Fm::Path::getDesktop().toStr();
QString desktopDir = QString(dektopPath) + QString("/"); QString desktopDir = QString(dektopPath) + QString("/");
g_free(dektopPath); g_free(dektopPath);
Q_FOREACH(const QString& name, file.childGroups()) { Q_FOREACH(const QString& name, file.childGroups()) {
@ -647,8 +653,8 @@ void DesktopWindow::onStickToCurrentPos(bool toggled) {
QModelIndexList indexes = listView_->selectionModel()->selectedIndexes(); QModelIndexList indexes = listView_->selectionModel()->selectedIndexes();
if(!indexes.isEmpty()) { if(!indexes.isEmpty()) {
FmFileInfo* file = menu->firstFile(); Fm::FileInfo file = menu->firstFile();
QByteArray name = fm_file_info_get_name(file); QByteArray name = file.getName();
QModelIndex index = indexes.first(); QModelIndex index = indexes.first();
if(toggled) { // remember to current custom position if(toggled) { // remember to current custom position
QRect itemRect = listView_->rectForIndex(index); QRect itemRect = listView_->rectForIndex(index);
@ -680,16 +686,16 @@ void DesktopWindow::queueRelayout(int delay) {
// slots for file operations // slots for file operations
void DesktopWindow::onCutActivated() { void DesktopWindow::onCutActivated() {
if(FmPathList* paths = selectedFilePaths()) { Fm::PathList paths = selectedFilePaths();
if(!paths.isNull()) {
Fm::cutFilesToClipboard(paths); Fm::cutFilesToClipboard(paths);
fm_path_list_unref(paths);
} }
} }
void DesktopWindow::onCopyActivated() { void DesktopWindow::onCopyActivated() {
if(FmPathList* paths = selectedFilePaths()) { Fm::PathList paths = selectedFilePaths();
if(!paths.isNull()) {
Fm::copyFilesToClipboard(paths); Fm::copyFilesToClipboard(paths);
fm_path_list_unref(paths);
} }
} }
@ -698,31 +704,31 @@ void DesktopWindow::onPasteActivated() {
} }
void DesktopWindow::onDeleteActivated() { void DesktopWindow::onDeleteActivated() {
if(FmPathList* paths = selectedFilePaths()) { Fm::PathList paths = selectedFilePaths();
if(!paths.isNull()) {
Settings& settings = static_cast<Application*>(qApp)->settings(); Settings& settings = static_cast<Application*>(qApp)->settings();
bool shiftPressed = (qApp->keyboardModifiers() & Qt::ShiftModifier ? true : false); bool shiftPressed = (qApp->keyboardModifiers() & Qt::ShiftModifier ? true : false);
if(settings.useTrash() && !shiftPressed) if(settings.useTrash() && !shiftPressed)
Fm::FileOperation::trashFiles(paths, settings.confirmTrash()); Fm::FileOperation::trashFiles(paths, settings.confirmTrash());
else else
Fm::FileOperation::deleteFiles(paths, settings.confirmDelete()); Fm::FileOperation::deleteFiles(paths, settings.confirmDelete());
fm_path_list_unref(paths);
} }
} }
void DesktopWindow::onRenameActivated() { void DesktopWindow::onRenameActivated() {
if(FmFileInfoList* files = selectedFiles()) { Fm::FileInfoList files = selectedFiles();
if(!files.isNull()) {
for(GList* l = fm_file_info_list_peek_head_link(files); l; l = l->next) { for(GList* l = fm_file_info_list_peek_head_link(files); l; l = l->next) {
FmFileInfo* info = FM_FILE_INFO(l->data); FmFileInfo* info = FM_FILE_INFO(l->data);
Fm::renameFile(info, NULL); Fm::renameFile(info, NULL);
fm_file_info_list_unref(files);
} }
} }
} }
void DesktopWindow::onFilePropertiesActivated() { void DesktopWindow::onFilePropertiesActivated() {
if(FmFileInfoList* files = selectedFiles()) { Fm::FileInfoList files = selectedFiles();
if(!files.isNull()) {
Fm::FilePropsDialog::showForFiles(files); Fm::FilePropsDialog::showForFiles(files);
fm_file_info_list_unref(files);
} }
} }

@ -27,6 +27,7 @@
#include <QPoint> #include <QPoint>
#include <QByteArray> #include <QByteArray>
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <libfm-qt/folder.h>
namespace Fm { namespace Fm {
class CachedFolderModel; class CachedFolderModel;
@ -98,6 +99,7 @@ protected Q_SLOTS:
void onRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end); void onRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
void onRowsInserted(const QModelIndex& parent, int start, int end); void onRowsInserted(const QModelIndex& parent, int start, int end);
void onLayoutChanged(); void onLayoutChanged();
void onModelSortFilterChanged();
void onIndexesMoved(const QModelIndexList& indexes); void onIndexesMoved(const QModelIndexList& indexes);
void relayoutItems(); void relayoutItems();
@ -119,7 +121,7 @@ private:
private: private:
Fm::ProxyFolderModel* proxyModel_; Fm::ProxyFolderModel* proxyModel_;
Fm::CachedFolderModel* model_; Fm::CachedFolderModel* model_;
FmFolder* folder_; Fm::Folder folder_;
Fm::FolderViewListView* listView_; Fm::FolderViewListView* listView_;
QColor fgColor_; QColor fgColor_;

@ -38,11 +38,11 @@ Launcher::~Launcher() {
bool Launcher::openFolder(GAppLaunchContext* ctx, GList* folder_infos, GError** err) { bool Launcher::openFolder(GAppLaunchContext* ctx, GList* folder_infos, GError** err) {
GList* l = folder_infos; GList* l = folder_infos;
FmFileInfo* fi = FM_FILE_INFO(l->data); Fm::FileInfo fi = FM_FILE_INFO(l->data);
Application* app = static_cast<Application*>(qApp); Application* app = static_cast<Application*>(qApp);
MainWindow* mainWindow = mainWindow_; MainWindow* mainWindow = mainWindow_;
if(!mainWindow) { if(!mainWindow) {
mainWindow = new MainWindow(fm_file_info_get_path(fi)); mainWindow = new MainWindow(fi.getPath());
mainWindow->resize(app->settings().windowWidth(), app->settings().windowHeight()); mainWindow->resize(app->settings().windowWidth(), app->settings().windowHeight());
if(app->settings().windowMaximized()) { if(app->settings().windowMaximized()) {
@ -50,11 +50,11 @@ bool Launcher::openFolder(GAppLaunchContext* ctx, GList* folder_infos, GError**
} }
} }
else else
mainWindow->chdir(fm_file_info_get_path(fi)); mainWindow->chdir(fi.getPath());
l = l->next; l = l->next;
for(; l; l = l->next) { for(; l; l = l->next) {
fi = FM_FILE_INFO(l->data); fi = FM_FILE_INFO(l->data);
mainWindow->addTab(fm_file_info_get_path(fi)); mainWindow->addTab(fi.getPath());
} }
mainWindow->show(); mainWindow->show();
mainWindow->raise(); mainWindow->raise();

@ -86,15 +86,15 @@
</item> </item>
<item> <item>
<widget class="QLineEdit" name="filterBar"> <widget class="QLineEdit" name="filterBar">
<property name="toolTip">
<string>Focus with Ctrl+I</string>
</property>
<property name="placeholderText"> <property name="placeholderText">
<string>Filter by string...</string> <string>Filter by string...</string>
</property> </property>
<property name="clearButtonEnabled"> <property name="clearButtonEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="toolTip">
<string>Focus with Ctrl+I</string>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -109,7 +109,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>460</width> <width>460</width>
<height>23</height> <height>30</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_File"> <widget class="QMenu" name="menu_File">
@ -160,15 +160,23 @@
<addaction name="actionFolderFirst"/> <addaction name="actionFolderFirst"/>
<addaction name="actionCaseSensitive"/> <addaction name="actionCaseSensitive"/>
</widget> </widget>
<addaction name="actionReload"/> <widget class="QMenu" name="menu_View_2">
<addaction name="actionShowHidden"/> <property name="title">
<addaction name="separator"/> <string>&amp;View</string>
</property>
<addaction name="actionIconView"/> <addaction name="actionIconView"/>
<addaction name="actionThumbnailView"/> <addaction name="actionThumbnailView"/>
<addaction name="actionCompactView"/> <addaction name="actionCompactView"/>
<addaction name="actionDetailedList"/> <addaction name="actionDetailedList"/>
<addaction name="separator"/> <addaction name="separator"/>
</widget>
<addaction name="actionReload"/>
<addaction name="separator"/>
<addaction name="actionShowHidden"/>
<addaction name="menuSorting"/> <addaction name="menuSorting"/>
<addaction name="menu_View_2"/>
<addaction name="actionPreserveView"/>
<addaction name="separator"/>
<addaction name="actionFilter"/> <addaction name="actionFilter"/>
<addaction name="actionMenu_bar"/> <addaction name="actionMenu_bar"/>
</widget> </widget>
@ -531,6 +539,14 @@
<string>&amp;Folder First</string> <string>&amp;Folder First</string>
</property> </property>
</action> </action>
<action name="actionPreserveSorting">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Preserve sorting for this folder</string>
</property>
</action>
<action name="actionNewTab"> <action name="actionNewTab">
<property name="icon"> <property name="icon">
<iconset theme="window-new"> <iconset theme="window-new">
@ -718,7 +734,7 @@
<normaloff>.</normaloff>.</iconset> <normaloff>.</normaloff>.</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Close &amp;left tabs</string> <string>Close &amp;previous tabs</string>
</property> </property>
</action> </action>
<action name="actionCloseRight"> <action name="actionCloseRight">
@ -727,7 +743,7 @@
<normaloff>.</normaloff>.</iconset> <normaloff>.</normaloff>.</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Close &amp;right tabs</string> <string>Close &amp;next tabs</string>
</property> </property>
</action> </action>
<action name="actionCloseOther"> <action name="actionCloseOther">
@ -751,7 +767,8 @@
</action> </action>
<action name="actionMenu"> <action name="actionMenu">
<property name="icon"> <property name="icon">
<iconset theme="application-menu"/> <iconset theme="application-menu">
<normaloff>.</normaloff>.</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Menu</string> <string>Menu</string>
@ -760,6 +777,14 @@
<string>Menu</string> <string>Menu</string>
</property> </property>
</action> </action>
<action name="actionPreserveView">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Preserve Settings for This Folder</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

@ -29,6 +29,8 @@
#include <QToolButton> #include <QToolButton>
#include <QShortcut> #include <QShortcut>
#include <QKeySequence> #include <QKeySequence>
#include <QDir>
#include <QSettings>
#include <QDebug> #include <QDebug>
#include "tabpage.h" #include "tabpage.h"
@ -39,9 +41,11 @@
#include <libfm-qt/utilities.h> #include <libfm-qt/utilities.h>
#include <libfm-qt/filepropsdialog.h> #include <libfm-qt/filepropsdialog.h>
#include <libfm-qt/pathedit.h> #include <libfm-qt/pathedit.h>
#include <libfm-qt/path.h>
#include <libfm-qt/fileinfo.h>
#include <libfm-qt/folder.h>
#include "ui_about.h" #include "ui_about.h"
#include "application.h" #include "application.h"
#include <libfm-qt/path.h>
// #include "qmodeltest/modeltest.h" // #include "qmodeltest/modeltest.h"
@ -49,10 +53,11 @@ using namespace Fm;
namespace PCManFM { namespace PCManFM {
MainWindow::MainWindow(FmPath* path): MainWindow::MainWindow(Path path):
QMainWindow(), QMainWindow(),
fileLauncher_(this), fileLauncher_(this),
rightClickIndex(-1) { rightClickIndex(-1),
updatingViewMenu_(false) {
Settings& settings = static_cast<Application*>(qApp)->settings(); Settings& settings = static_cast<Application*>(qApp)->settings();
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
@ -128,6 +133,7 @@ MainWindow::MainWindow(FmPath* path):
// path bar // path bar
pathEntry = new Fm::PathEdit(this); pathEntry = new Fm::PathEdit(this);
connect(pathEntry, &Fm::PathEdit::returnPressed, this, &MainWindow::onPathEntryReturnPressed); connect(pathEntry, &Fm::PathEdit::returnPressed, this, &MainWindow::onPathEntryReturnPressed);
connect(pathEntry, &QLineEdit::textEdited, this, &MainWindow::onPathEntryEdited);
ui.toolBar->insertWidget(ui.actionGo, pathEntry); ui.toolBar->insertWidget(ui.actionGo, pathEntry);
// add filesystem info to status bar // add filesystem info to status bar
@ -142,7 +148,7 @@ MainWindow::MainWindow(FmPath* path):
ui.splitter->setSizes(sizes); ui.splitter->setSizes(sizes);
// load bookmark menu // load bookmark menu
bookmarks = fm_bookmarks_dup(); bookmarks = Fm::Bookmarks::dup();
g_signal_connect(bookmarks, "changed", G_CALLBACK(onBookmarksChanged), this); g_signal_connect(bookmarks, "changed", G_CALLBACK(onBookmarksChanged), this);
loadBookmarksMenu(); loadBookmarksMenu();
@ -173,7 +179,7 @@ MainWindow::MainWindow(FmPath* path):
addActions(ui.menubar->actions()); addActions(ui.menubar->actions());
// Show or hide the menu bar // Show or hide the menu bar
QMenu *menu = new QMenu(); QMenu *menu = new QMenu(ui.toolBar);
menu->addMenu(ui.menu_File); menu->addMenu(ui.menu_File);
menu->addMenu(ui.menu_Editw); menu->addMenu(ui.menu_Editw);
menu->addMenu(ui.menu_View); menu->addMenu(ui.menu_View);
@ -250,7 +256,7 @@ MainWindow::MainWindow(FmPath* path):
connect(shortcut, &QShortcut::activated, ui.filterBar, &QLineEdit::clear); connect(shortcut, &QShortcut::activated, ui.filterBar, &QLineEdit::clear);
} }
if(path) if(!path.isNull())
addTab(path); addTab(path);
// size from settings // size from settings
@ -259,16 +265,18 @@ MainWindow::MainWindow(FmPath* path):
if(settings.windowMaximized()) if(settings.windowMaximized())
setWindowState(windowState() | Qt::WindowMaximized); setWindowState(windowState() | Qt::WindowMaximized);
} }
if(QApplication::layoutDirection() == Qt::RightToLeft)
setRTLIcons(true);
} }
MainWindow::~MainWindow() { MainWindow::~MainWindow() {
if(bookmarks) { if(!bookmarks.isNull()) {
g_signal_handlers_disconnect_by_func(bookmarks, (gpointer)G_CALLBACK(onBookmarksChanged), this); g_signal_handlers_disconnect_by_func(bookmarks, (gpointer)G_CALLBACK(onBookmarksChanged), this);
g_object_unref(bookmarks);
} }
} }
void MainWindow::chdir(FmPath* path) { void MainWindow::chdir(Path path) {
TabPage* page = currentPage(); TabPage* page = currentPage();
if(page) { if(page) {
@ -279,7 +287,7 @@ void MainWindow::chdir(FmPath* path) {
} }
// add a new tab // add a new tab
int MainWindow::addTab(FmPath* path) { int MainWindow::addTab(Path path) {
Settings& settings = static_cast<Application*>(qApp)->settings(); Settings& settings = static_cast<Application*>(qApp)->settings();
TabPage* newPage = new TabPage(path, this); TabPage* newPage = new TabPage(path, this);
@ -328,9 +336,15 @@ void MainWindow::toggleMenuBar(bool checked) {
void MainWindow::onPathEntryReturnPressed() { void MainWindow::onPathEntryReturnPressed() {
QString text = pathEntry->text(); QString text = pathEntry->text();
QByteArray utext = text.toUtf8(); QByteArray utext = text.toUtf8();
FmPath* path = fm_path_new_for_display_name(utext); chdir(Fm::Path::newForDisplayName(utext));
chdir(path); }
fm_path_unref(path);
void MainWindow::onPathEntryEdited(const QString& text) {
QString realText(text);
if(realText == "~" || realText.startsWith("~/")) {
realText.replace(0, 1, QDir::homePath());
pathEntry->setText(realText);
}
} }
void MainWindow::on_actionGoUp_triggered() { void MainWindow::on_actionGoUp_triggered() {
@ -364,11 +378,12 @@ void MainWindow::on_actionGoForward_triggered() {
} }
void MainWindow::on_actionHome_triggered() { void MainWindow::on_actionHome_triggered() {
chdir(fm_path_get_home()); chdir(Fm::Path::getHome());
} }
void MainWindow::on_actionReload_triggered() { void MainWindow::on_actionReload_triggered() {
currentPage()->reload(); currentPage()->reload();
pathEntry->setText(currentPage()->pathName());
} }
void MainWindow::on_actionGo_triggered() { void MainWindow::on_actionGo_triggered() {
@ -376,19 +391,19 @@ void MainWindow::on_actionGo_triggered() {
} }
void MainWindow::on_actionNewTab_triggered() { void MainWindow::on_actionNewTab_triggered() {
FmPath* path = currentPage()->path(); Fm::Path path = currentPage()->path();
int index = addTab(path); int index = addTab(path);
ui.tabBar->setCurrentIndex(index); ui.tabBar->setCurrentIndex(index);
} }
void MainWindow::on_actionNewWin_triggered() { void MainWindow::on_actionNewWin_triggered() {
FmPath* path = currentPage()->path(); Fm::Path path = currentPage()->path();
(new MainWindow(path))->show(); (new MainWindow(path))->show();
} }
void MainWindow::on_actionNewFolder_triggered() { void MainWindow::on_actionNewFolder_triggered() {
if(TabPage* tabPage = currentPage()) { if(TabPage* tabPage = currentPage()) {
FmPath* dirPath = tabPage->folderView()->path(); Fm::Path dirPath = tabPage->folderView()->path();
if(dirPath) if(dirPath)
createFileOrFolder(CreateNewFolder, dirPath); createFileOrFolder(CreateNewFolder, dirPath);
@ -397,7 +412,7 @@ void MainWindow::on_actionNewFolder_triggered() {
void MainWindow::on_actionNewBlankFile_triggered() { void MainWindow::on_actionNewBlankFile_triggered() {
if(TabPage* tabPage = currentPage()) { if(TabPage* tabPage = currentPage()) {
FmPath* dirPath = tabPage->folderView()->path(); Fm::Path dirPath = tabPage->folderView()->path();
if(dirPath) if(dirPath)
createFileOrFolder(CreateNewTextFile, dirPath); createFileOrFolder(CreateNewTextFile, dirPath);
@ -416,13 +431,10 @@ void MainWindow::on_actionCloseWindow_triggered() {
void MainWindow::on_actionFileProperties_triggered() { void MainWindow::on_actionFileProperties_triggered() {
TabPage* page = currentPage(); TabPage* page = currentPage();
if(page) { if(page) {
FmFileInfoList* files = page->selectedFiles(); Fm::FileInfoList files = page->selectedFiles();
if(!files.isNull()) {
if(files) {
Fm::FilePropsDialog::showForFiles(files); Fm::FilePropsDialog::showForFiles(files);
fm_file_info_list_unref(files);
} }
} }
} }
@ -431,22 +443,18 @@ void MainWindow::on_actionFolderProperties_triggered() {
TabPage* page = currentPage(); TabPage* page = currentPage();
if(page) { if(page) {
FmFolder* folder = page->folder(); Fm::Folder folder = page->folder();
if(!folder.isNull()) {
if(folder) { Fm::FileInfo info = folder.getInfo();
FmFileInfo* info = fm_folder_get_info(folder); if(!info.isNull())
if(info)
Fm::FilePropsDialog::showForFile(info); Fm::FilePropsDialog::showForFile(info);
} }
} }
} }
void MainWindow::on_actionShowHidden_triggered(bool checked) { void MainWindow::on_actionShowHidden_triggered(bool checked) {
TabPage* tabPage = currentPage(); currentPage()->setShowHidden(checked);
tabPage->setShowHidden(checked);
ui.sidePane->setShowHidden(checked); ui.sidePane->setShowHidden(checked);
static_cast<Application*>(qApp)->settings().setShowHidden(checked);
} }
void MainWindow::on_actionByFileName_triggered(bool checked) { void MainWindow::on_actionByFileName_triggered(bool checked) {
@ -485,6 +493,11 @@ void MainWindow::on_actionFolderFirst_triggered(bool checked) {
currentPage()->setSortFolderFirst(checked); currentPage()->setSortFolderFirst(checked);
} }
void MainWindow::on_actionPreserveView_triggered(bool checked) {
TabPage* page = currentPage();
page->setCustomizedView(!page->hasCustomizedView());
}
void MainWindow::on_actionFilter_triggered(bool checked) { void MainWindow::on_actionFilter_triggered(bool checked) {
ui.filterBar->setVisible(checked); ui.filterBar->setVisible(checked);
if(checked) if(checked)
@ -506,38 +519,32 @@ void MainWindow::on_actionFilter_triggered(bool checked) {
} }
void MainWindow::on_actionComputer_triggered() { void MainWindow::on_actionComputer_triggered() {
FmPath* path = fm_path_new_for_uri("computer:///"); chdir(Fm::Path::newForUri("computer:///"));
chdir(path);
fm_path_unref(path);
} }
void MainWindow::on_actionApplications_triggered() { void MainWindow::on_actionApplications_triggered() {
chdir(fm_path_get_apps_menu()); chdir(Fm::Path::getAppsMenu());
} }
void MainWindow::on_actionTrash_triggered() { void MainWindow::on_actionTrash_triggered() {
chdir(fm_path_get_trash()); chdir(Fm::Path::getTrash());
} }
void MainWindow::on_actionNetwork_triggered() { void MainWindow::on_actionNetwork_triggered() {
FmPath* path = fm_path_new_for_uri("network:///"); chdir(Fm::Path::newForUri("network:///"));
chdir(path);
fm_path_unref(path);
} }
void MainWindow::on_actionDesktop_triggered() { void MainWindow::on_actionDesktop_triggered() {
chdir(fm_path_get_desktop()); chdir(Fm::Path::getDesktop());
} }
void MainWindow::on_actionAddToBookmarks_triggered() { void MainWindow::on_actionAddToBookmarks_triggered() {
TabPage* page = currentPage(); TabPage* page = currentPage();
if(page) { if(page) {
FmPath* cwd = page->path(); Fm::Path cwd = page->path();
if(!cwd.isNull()) {
if(cwd) { char* dispName = cwd.displayBasename();
char* dispName = fm_path_display_basename(cwd); bookmarks.insert(cwd, dispName, -1);
fm_bookmarks_insert(bookmarks, cwd, dispName, -1);
g_free(dispName); g_free(dispName);
} }
} }
@ -585,7 +592,7 @@ void MainWindow::onTabBarCloseRequested(int index) {
void MainWindow::onResetFocus() { void MainWindow::onResetFocus() {
if(TabPage* page = currentPage()) { if(TabPage* page = currentPage()) {
currentPage()->folderView()->childView()->setFocus(); page->folderView()->childView()->setFocus();
} }
} }
@ -679,11 +686,14 @@ void MainWindow::updateStatusBarForCurrentPage() {
} }
void MainWindow::updateViewMenuForCurrentPage() { void MainWindow::updateViewMenuForCurrentPage() {
if(updatingViewMenu_) // prevent recursive calls
return;
updatingViewMenu_ = true;
TabPage* tabPage = currentPage(); TabPage* tabPage = currentPage();
if(tabPage) { if(tabPage) {
// update menus. FIXME: should we move this to another method? // update menus. FIXME: should we move this to another method?
ui.actionShowHidden->setChecked(tabPage->showHidden()); ui.actionShowHidden->setChecked(tabPage->showHidden());
ui.actionPreserveView->setChecked(tabPage->hasCustomizedView());
// view mode // view mode
QAction* modeAction = NULL; QAction* modeAction = NULL;
@ -722,10 +732,10 @@ void MainWindow::updateViewMenuForCurrentPage() {
ui.actionAscending->setChecked(true); ui.actionAscending->setChecked(true);
else else
ui.actionDescending->setChecked(true); ui.actionDescending->setChecked(true);
ui.actionCaseSensitive->setChecked(tabPage->sortCaseSensitive()); ui.actionCaseSensitive->setChecked(tabPage->sortCaseSensitive());
ui.actionFolderFirst->setChecked(tabPage->sortFolderFirst()); ui.actionFolderFirst->setChecked(tabPage->sortFolderFirst());
} }
updatingViewMenu_ = false;
} }
void MainWindow::updateUIForCurrentPage() { void MainWindow::updateUIForCurrentPage() {
@ -811,22 +821,23 @@ void MainWindow::onTabPageOpenDirRequested(FmPath* path, int target) {
addTab(path); addTab(path);
break; break;
case OpenInNewWindow: { case OpenInNewWindow:
(new MainWindow(path))->show(); (new MainWindow(path))->show();
break; break;
} }
}
} }
void MainWindow::onTabPageSortFilterChanged() { void MainWindow::onTabPageSortFilterChanged() {
TabPage* tabPage = static_cast<TabPage*>(sender()); TabPage* tabPage = static_cast<TabPage*>(sender());
if(tabPage == currentPage()) { if(tabPage == currentPage()) {
updateViewMenuForCurrentPage(); updateViewMenuForCurrentPage();
if(!tabPage->hasCustomizedView()) {
Settings& settings = static_cast<Application*>(qApp)->settings(); Settings& settings = static_cast<Application*>(qApp)->settings();
settings.setSortColumn(static_cast<Fm::FolderModel::ColumnId>(tabPage->sortColumn())); settings.setSortColumn(static_cast<Fm::FolderModel::ColumnId>(tabPage->sortColumn()));
settings.setSortOrder(tabPage->sortOrder()); settings.setSortOrder(tabPage->sortOrder());
settings.setSortFolderFirst(tabPage->sortFolderFirst()); settings.setSortFolderFirst(tabPage->sortFolderFirst());
settings.setSortCaseSensitive(tabPage->sortCaseSensitive());
}
} }
} }
@ -868,7 +879,7 @@ void MainWindow::onSplitterMoved(int pos, int index) {
} }
void MainWindow::loadBookmarksMenu() { void MainWindow::loadBookmarksMenu() {
GList* allBookmarks = fm_bookmarks_get_all(bookmarks); GList* allBookmarks = bookmarks.getAll();
QAction* before = ui.actionAddToBookmarks; QAction* before = ui.actionAddToBookmarks;
for(GList* l = allBookmarks; l; l = l->next) { for(GList* l = allBookmarks; l; l = l->next) {
@ -899,7 +910,7 @@ void MainWindow::onBookmarksChanged(FmBookmarks* bookmarks, MainWindow* pThis) {
void MainWindow::onBookmarkActionTriggered() { void MainWindow::onBookmarkActionTriggered() {
BookmarkAction* action = static_cast<BookmarkAction*>(sender()); BookmarkAction* action = static_cast<BookmarkAction*>(sender());
FmPath* path = action->path(); Fm::Path path = action->path();
if(path) { if(path) {
Application* app = static_cast<Application*>(qApp); Application* app = static_cast<Application*>(qApp);
Settings& settings = app->settings(); Settings& settings = app->settings();
@ -920,16 +931,14 @@ void MainWindow::onBookmarkActionTriggered() {
void MainWindow::on_actionCopy_triggered() { void MainWindow::on_actionCopy_triggered() {
TabPage* page = currentPage(); TabPage* page = currentPage();
FmPathList* paths = page->selectedFilePaths(); Fm::PathList paths = page->selectedFilePaths();
copyFilesToClipboard(paths); copyFilesToClipboard(paths);
fm_path_list_unref(paths);
} }
void MainWindow::on_actionCut_triggered() { void MainWindow::on_actionCut_triggered() {
TabPage* page = currentPage(); TabPage* page = currentPage();
FmPathList* paths = page->selectedFilePaths(); Fm::PathList paths = page->selectedFilePaths();
cutFilesToClipboard(paths); cutFilesToClipboard(paths);
fm_path_list_unref(paths);
} }
void MainWindow::on_actionPaste_triggered() { void MainWindow::on_actionPaste_triggered() {
@ -940,26 +949,22 @@ void MainWindow::on_actionDelete_triggered() {
Application* app = static_cast<Application*>(qApp); Application* app = static_cast<Application*>(qApp);
Settings& settings = app->settings(); Settings& settings = app->settings();
TabPage* page = currentPage(); TabPage* page = currentPage();
FmPathList* paths = page->selectedFilePaths(); Fm::PathList paths = page->selectedFilePaths();
bool shiftPressed = (qApp->keyboardModifiers() & Qt::ShiftModifier ? true : false); bool shiftPressed = (qApp->keyboardModifiers() & Qt::ShiftModifier ? true : false);
if(settings.useTrash() && !shiftPressed) if(settings.useTrash() && !shiftPressed)
FileOperation::trashFiles(paths, settings.confirmTrash(), this); FileOperation::trashFiles(paths, settings.confirmTrash(), this);
else else
FileOperation::deleteFiles(paths, settings.confirmDelete(), this); FileOperation::deleteFiles(paths, settings.confirmDelete(), this);
fm_path_list_unref(paths);
} }
void MainWindow::on_actionRename_triggered() { void MainWindow::on_actionRename_triggered() {
TabPage* page = currentPage(); TabPage* page = currentPage();
FmFileInfoList* files = page->selectedFiles(); Fm::FileInfoList files = page->selectedFiles();
for(GList* l = fm_file_info_list_peek_head_link(files); l; l = l->next) { for(GList* l = fm_file_info_list_peek_head_link(files); l; l = l->next) {
FmFileInfo* file = FM_FILE_INFO(l->data); FmFileInfo* file = FM_FILE_INFO(l->data);
Fm::renameFile(file, NULL); Fm::renameFile(file, NULL);
} }
fm_file_info_list_unref(files);
} }
@ -976,15 +981,34 @@ void MainWindow::on_actionPreferences_triggered() {
app->preferences(QString()); app->preferences(QString());
} }
/* // change some icons according to layout direction
void MainWindow::changeEvent(QEvent* event) { void MainWindow::setRTLIcons(bool isRTL) {
QIcon nxtIcn = QIcon::fromTheme("go-next");
QIcon prevIcn = QIcon::fromTheme("go-previous");
if(isRTL) {
ui.actionGoBack->setIcon(nxtIcn);
ui.actionCloseLeft->setIcon(nxtIcn);
ui.actionGoForward->setIcon(prevIcn);
ui.actionCloseRight->setIcon(prevIcn);
}
else {
ui.actionGoBack->setIcon(prevIcn);
ui.actionCloseLeft->setIcon(prevIcn);
ui.actionGoForward->setIcon(nxtIcn);
ui.actionCloseRight->setIcon(nxtIcn);
}
}
void MainWindow::changeEvent(QEvent *event) {
switch(event->type()) { switch(event->type()) {
case QEvent::StyleChange: case QEvent::LayoutDirectionChange:
setRTLIcons(QApplication::layoutDirection() == Qt::RightToLeft);
break;
default:
break; break;
} }
QWidget::changeEvent(event); QWidget::changeEvent(event);
} }
*/
void MainWindow::onBackForwardContextMenu(QPoint pos) { void MainWindow::onBackForwardContextMenu(QPoint pos) {
// show a popup menu for browsing history here. // show a popup menu for browsing history here.
@ -996,7 +1020,9 @@ void MainWindow::onBackForwardContextMenu(QPoint pos) {
for(int i = 0; i < history.size(); ++i) { for(int i = 0; i < history.size(); ++i) {
const BrowseHistoryItem& item = history.at(i); const BrowseHistoryItem& item = history.at(i);
Fm::Path path = item.path(); Fm::Path path = item.path();
QAction* action = menu.addAction(path.displayName()); char* name = path.displayName(true);
QAction* action = menu.addAction(QString::fromUtf8(name));
g_free(name);
if(i == current) { if(i == current) {
// make the current path bold and checked // make the current path bold and checked
action->setCheckable(true); action->setCheckable(true);
@ -1122,9 +1148,9 @@ void MainWindow::on_actionOpenAsRoot_triggered() {
g_free(cmd); g_free(cmd);
if(appInfo) { if(appInfo) {
FmPath* cwd = page->path(); Fm::Path cwd = page->path();
GError* err = NULL; GError* err = NULL;
char* uri = fm_path_to_uri(cwd); char* uri = cwd.toUri();
GList* uris = g_list_prepend(NULL, uri); GList* uris = g_list_prepend(NULL, uri);
if(!g_app_info_launch_uris(appInfo, uris, NULL, &err)) { if(!g_app_info_launch_uris(appInfo, uris, NULL, &err)) {
@ -1147,16 +1173,15 @@ void MainWindow::on_actionOpenAsRoot_triggered() {
void MainWindow::on_actionFindFiles_triggered() { void MainWindow::on_actionFindFiles_triggered() {
Application* app = static_cast<Application*>(qApp); Application* app = static_cast<Application*>(qApp);
FmPathList* selectedPaths = currentPage()->selectedFilePaths(); Fm::PathList selectedPaths = currentPage()->selectedFilePaths();
QStringList paths; QStringList paths;
if(selectedPaths) { if(!selectedPaths.isNull()) {
for(GList* l = fm_path_list_peek_head_link(selectedPaths); l; l = l->next) { for(GList* l = fm_path_list_peek_head_link(selectedPaths); l; l = l->next) {
// FIXME: is it ok to use display name here? // FIXME: is it ok to use display name here?
// This might be broken on filesystems with non-UTF-8 filenames. // This might be broken on filesystems with non-UTF-8 filenames.
Fm::Path path(FM_PATH(l->data)); Fm::Path path(FM_PATH(l->data));
paths.append(path.displayName(false)); paths.append(path.displayName(false));
} }
fm_path_list_unref(selectedPaths);
} }
else { else {
paths.append(currentPage()->pathName()); paths.append(currentPage()->pathName());

@ -32,6 +32,8 @@
#include <QStackedWidget> #include <QStackedWidget>
#include <QSplitter> #include <QSplitter>
#include "launcher.h" #include "launcher.h"
#include <libfm-qt/bookmarks.h>
#include <libfm-qt/path.h>
namespace PCManFM { namespace PCManFM {
@ -41,11 +43,11 @@ class Settings;
class MainWindow : public QMainWindow { class MainWindow : public QMainWindow {
Q_OBJECT Q_OBJECT
public: public:
MainWindow(FmPath* path = NULL); MainWindow(Fm::Path path = Fm::Path());
virtual ~MainWindow(); virtual ~MainWindow();
void chdir(FmPath* path); void chdir(Fm::Path path);
int addTab(FmPath* path); int addTab(Fm::Path path);
TabPage* currentPage() { TabPage* currentPage() {
return reinterpret_cast<TabPage*>(ui.stackedWidget->currentWidget()); return reinterpret_cast<TabPage*>(ui.stackedWidget->currentWidget());
@ -56,6 +58,7 @@ public:
protected Q_SLOTS: protected Q_SLOTS:
void onPathEntryReturnPressed(); void onPathEntryReturnPressed();
void onPathEntryEdited(const QString& text);
void on_actionNewTab_triggered(); void on_actionNewTab_triggered();
void on_actionNewWin_triggered(); void on_actionNewWin_triggered();
@ -88,6 +91,7 @@ protected Q_SLOTS:
void on_actionGo_triggered(); void on_actionGo_triggered();
void on_actionShowHidden_triggered(bool check); void on_actionShowHidden_triggered(bool check);
void on_actionPreserveView_triggered(bool checked);
void on_actionByFileName_triggered(bool checked); void on_actionByFileName_triggered(bool checked);
void on_actionByMTime_triggered(bool checked); void on_actionByMTime_triggered(bool checked);
@ -156,7 +160,7 @@ protected Q_SLOTS:
void toggleMenuBar(bool checked); void toggleMenuBar(bool checked);
protected: protected:
// void changeEvent( QEvent * event); void changeEvent(QEvent *event);
void closeTab(int index); void closeTab(int index);
virtual void resizeEvent(QResizeEvent *event); virtual void resizeEvent(QResizeEvent *event);
virtual void closeEvent(QCloseEvent *event); virtual void closeEvent(QCloseEvent *event);
@ -167,14 +171,16 @@ private:
void updateUIForCurrentPage(); void updateUIForCurrentPage();
void updateViewMenuForCurrentPage(); void updateViewMenuForCurrentPage();
void updateStatusBarForCurrentPage(); void updateStatusBarForCurrentPage();
void setRTLIcons(bool isRTL);
private: private:
Ui::MainWindow ui; Ui::MainWindow ui;
QLineEdit* pathEntry; QLineEdit* pathEntry;
QLabel* fsInfoLabel; QLabel* fsInfoLabel;
FmBookmarks* bookmarks; Fm::Bookmarks bookmarks;
Launcher fileLauncher_; Launcher fileLauncher_;
int rightClickIndex; int rightClickIndex;
bool updatingViewMenu_;
}; };
} }

@ -245,33 +245,54 @@
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="toolTip">
<string>Used by Icon View</string>
</property>
<property name="text"> <property name="text">
<string>Size of big icons:</string> <string>Size of big icons:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="bigIconSize"/> <widget class="QComboBox" name="bigIconSize">
<property name="toolTip">
<string>Used by Icon View</string>
</property>
</widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="toolTip">
<string>Used by Compact View and Detailed List View</string>
</property>
<property name="text"> <property name="text">
<string>Size of small icons:</string> <string>Size of small icons:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QComboBox" name="smallIconSize"/> <widget class="QComboBox" name="smallIconSize">
<property name="toolTip">
<string>Used by Compact View and Detailed List View</string>
</property>
</widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="toolTip">
<string>Used by Thumbnail View</string>
</property>
<property name="text"> <property name="text">
<string>Size of thumbnails:</string> <string>Size of thumbnails:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QComboBox" name="thumbnailIconSize"/> <widget class="QComboBox" name="thumbnailIconSize">
<property name="toolTip">
<string>Used by Thumbnail View</string>
</property>
</widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
@ -440,6 +461,10 @@ A space is also reserved for 3 lines of text.</string>
</property> </property>
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="alwaysShowTabs"> <widget class="QCheckBox" name="alwaysShowTabs">
<property name="toolTip">
<string>When unchecked, the tab bar will be shown
only if there are more than one tab.</string>
</property>
<property name="text"> <property name="text">
<string>Always show the tab bar</string> <string>Always show the tab bar</string>
</property> </property>
@ -644,6 +669,9 @@ above the folder-view and not above the left pane.</string>
</item> </item>
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="showThumbnails"> <widget class="QCheckBox" name="showThumbnails">
<property name="toolTip">
<string>Needs ffmpegthumbnailer</string>
</property>
<property name="text"> <property name="text">
<string>Show thumbnails of files</string> <string>Show thumbnails of files</string>
</property> </property>

@ -187,7 +187,7 @@ void PreferencesDialog::initBehaviorPage(Settings& settings) {
ui.bookmarkOpenMethod->setCurrentIndex(settings.bookmarkOpenMethod()); ui.bookmarkOpenMethod->setCurrentIndex(settings.bookmarkOpenMethod());
ui.viewMode->addItem(tr("Icon View"), (int)Fm::FolderView::IconMode); ui.viewMode->addItem(tr("Icon View"), (int)Fm::FolderView::IconMode);
ui.viewMode->addItem(tr("Compact Icon View"), (int)Fm::FolderView::CompactMode); ui.viewMode->addItem(tr("Compact View"), (int)Fm::FolderView::CompactMode);
ui.viewMode->addItem(tr("Thumbnail View"), (int)Fm::FolderView::ThumbnailMode); ui.viewMode->addItem(tr("Thumbnail View"), (int)Fm::FolderView::ThumbnailMode);
ui.viewMode->addItem(tr("Detailed List View"), (int)Fm::FolderView::DetailedListMode); ui.viewMode->addItem(tr("Detailed List View"), (int)Fm::FolderView::DetailedListMode);
const Fm::FolderView::ViewMode modes[] = { const Fm::FolderView::ViewMode modes[] = {

@ -26,7 +26,8 @@
#include <QApplication> #include <QApplication>
#include "desktopwindow.h" #include "desktopwindow.h"
#include <libfm-qt/utilities.h> #include <libfm-qt/utilities.h>
// #include <QDesktopServices> #include <libfm-qt/folderconfig.h>
#include <QStandardPaths>
namespace PCManFM { namespace PCManFM {
@ -65,10 +66,12 @@ Settings::Settings():
desktopBgColor_(), desktopBgColor_(),
desktopFgColor_(), desktopFgColor_(),
desktopShadowColor_(), desktopShadowColor_(),
desktopIconSize_(48),
showWmMenu_(false), showWmMenu_(false),
desktopShowHidden_(false), desktopShowHidden_(false),
desktopSortOrder_(Qt::AscendingOrder), desktopSortOrder_(Qt::AscendingOrder),
desktopSortColumn_(Fm::FolderModel::ColumnFileName), desktopSortColumn_(Fm::FolderModel::ColumnFileMTime),
desktopSortFolderFirst_(true),
alwaysShowTabs_(true), alwaysShowTabs_(true),
showTabClose_(true), showTabClose_(true),
rememberWindowSize_(true), rememberWindowSize_(true),
@ -86,6 +89,7 @@ Settings::Settings():
sortOrder_(Qt::AscendingOrder), sortOrder_(Qt::AscendingOrder),
sortColumn_(Fm::FolderModel::ColumnFileName), sortColumn_(Fm::FolderModel::ColumnFileName),
sortFolderFirst_(true), sortFolderFirst_(true),
sortCaseSensitive_(false),
showFilter_(false), showFilter_(false),
// settings for use with libfm // settings for use with libfm
singleClick_(false), singleClick_(false),
@ -117,16 +121,20 @@ Settings::~Settings() {
} }
QString Settings::profileDir(QString profile, bool useFallback) { QString Settings::xdgUserConfigDir() {
// NOTE: it's a shame that QDesktopServices does not handle XDG_CONFIG_HOME
// try user-specific config file first
QString dirName; QString dirName;
// WARNING: Don't use XDG_CONFIG_HOME with root because it might // WARNING: Don't use XDG_CONFIG_HOME with root because it might
// give the user config directory if gksu-properties is set to su. // give the user config directory if gksu-properties is set to su.
if(geteuid()) if(geteuid() != 0) // non-root user
dirName = QLatin1String(qgetenv("XDG_CONFIG_HOME")); dirName = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
if (dirName.isEmpty()) if (dirName.isEmpty())
dirName = QDir::homePath() % QLatin1String("/.config"); dirName = QDir::homePath() % QLatin1String("/.config");
return dirName;
}
QString Settings::profileDir(QString profile, bool useFallback) {
// try user-specific config file first
QString dirName = xdgUserConfigDir();
dirName = dirName % "/pcmanfm-qt/" % profile; dirName = dirName % "/pcmanfm-qt/" % profile;
QDir dir(dirName); QDir dir(dirName);
@ -163,7 +171,7 @@ bool Settings::loadFile(QString filePath) {
if(fallbackIconThemeName_.isEmpty()) { if(fallbackIconThemeName_.isEmpty()) {
// FIXME: we should choose one from installed icon themes or get // FIXME: we should choose one from installed icon themes or get
// the value from XSETTINGS instead of hard code a fallback value. // the value from XSETTINGS instead of hard code a fallback value.
fallbackIconThemeName_ = "elementary"; // fallback icon theme name fallbackIconThemeName_ = "oxygen"; // fallback icon theme name
} }
suCommand_ = settings.value("SuCommand", "lxqt-sudo %s").toString(); suCommand_ = settings.value("SuCommand", "lxqt-sudo %s").toString();
setTerminal(settings.value("Terminal", "xterm").toString()); setTerminal(settings.value("Terminal", "xterm").toString());
@ -200,11 +208,13 @@ bool Settings::loadFile(QString filePath) {
desktopFont_.fromString(settings.value("Font").toString()); desktopFont_.fromString(settings.value("Font").toString());
else else
desktopFont_ = QApplication::font(); desktopFont_ = QApplication::font();
desktopIconSize_ = settings.value("DesktopIconSize", 48).toInt();
showWmMenu_ = settings.value("ShowWmMenu", false).toBool(); showWmMenu_ = settings.value("ShowWmMenu", false).toBool();
desktopShowHidden_ = settings.value("ShowHidden", false).toBool(); desktopShowHidden_ = settings.value("ShowHidden", false).toBool();
desktopSortOrder_ = sortOrderFromString(settings.value("SortOrder").toString()); desktopSortOrder_ = sortOrderFromString(settings.value("SortOrder").toString());
desktopSortColumn_ = sortColumnFromString(settings.value("SortColumn").toString()); desktopSortColumn_ = sortColumnFromString(settings.value("SortColumn").toString());
desktopSortFolderFirst_ = settings.value("SortFolderFirst", true).toBool();
desktopCellMargins_ = (settings.value("DesktopCellMargins", QSize(3, 1)).toSize() desktopCellMargins_ = (settings.value("DesktopCellMargins", QSize(3, 1)).toSize()
.expandedTo(QSize(0, 0))).boundedTo(QSize(48, 48)); .expandedTo(QSize(0, 0))).boundedTo(QSize(48, 48));
@ -229,6 +239,7 @@ bool Settings::loadFile(QString filePath) {
sortOrder_ = sortOrderFromString(settings.value("SortOrder").toString()); sortOrder_ = sortOrderFromString(settings.value("SortOrder").toString());
sortColumn_ = sortColumnFromString(settings.value("SortColumn").toString()); sortColumn_ = sortColumnFromString(settings.value("SortColumn").toString());
sortFolderFirst_ = settings.value("SortFolderFirst", true).toBool(); sortFolderFirst_ = settings.value("SortFolderFirst", true).toBool();
sortCaseSensitive_ = settings.value("SortCaseSensitive", false).toBool();
showFilter_ = settings.value("ShowFilter", false).toBool(); showFilter_ = settings.value("ShowFilter", false).toBool();
setBackupAsHidden(settings.value("BackupAsHidden", false).toBool()); setBackupAsHidden(settings.value("BackupAsHidden", false).toBool());
@ -310,10 +321,12 @@ bool Settings::saveFile(QString filePath) {
settings.setValue("FgColor", desktopFgColor_.name()); settings.setValue("FgColor", desktopFgColor_.name());
settings.setValue("ShadowColor", desktopShadowColor_.name()); settings.setValue("ShadowColor", desktopShadowColor_.name());
settings.setValue("Font", desktopFont_.toString()); settings.setValue("Font", desktopFont_.toString());
settings.setValue("DesktopIconSize", desktopIconSize_);
settings.setValue("ShowWmMenu", showWmMenu_); settings.setValue("ShowWmMenu", showWmMenu_);
settings.setValue("ShowHidden", desktopShowHidden_); settings.setValue("ShowHidden", desktopShowHidden_);
settings.setValue("SortOrder", sortOrderToString(desktopSortOrder_)); settings.setValue("SortOrder", sortOrderToString(desktopSortOrder_));
settings.setValue("SortColumn", sortColumnToString(desktopSortColumn_)); settings.setValue("SortColumn", sortColumnToString(desktopSortColumn_));
settings.setValue("SortFolderFirst", desktopSortFolderFirst_);
settings.setValue("DesktopCellMargins", desktopCellMargins_); settings.setValue("DesktopCellMargins", desktopCellMargins_);
settings.endGroup(); settings.endGroup();
@ -336,6 +349,7 @@ bool Settings::saveFile(QString filePath) {
settings.setValue("SortOrder", sortOrderToString(sortOrder_)); settings.setValue("SortOrder", sortOrderToString(sortOrder_));
settings.setValue("SortColumn", sortColumnToString(sortColumn_)); settings.setValue("SortColumn", sortColumnToString(sortColumn_));
settings.setValue("SortFolderFirst", sortFolderFirst_); settings.setValue("SortFolderFirst", sortFolderFirst_);
settings.setValue("SortCaseSensitive", sortCaseSensitive_);
settings.setValue("ShowFilter", showFilter_); settings.setValue("ShowFilter", showFilter_);
settings.setValue("BackupAsHidden", backupAsHidden_); settings.setValue("BackupAsHidden", backupAsHidden_);
@ -375,6 +389,10 @@ bool Settings::saveFile(QString filePath) {
settings.setValue("ShowMenuBar", showMenuBar_); settings.setValue("ShowMenuBar", showMenuBar_);
settings.setValue("FullWidthTabBar", fullWidthTabBar_); settings.setValue("FullWidthTabBar", fullWidthTabBar_);
settings.endGroup(); settings.endGroup();
// save per-folder settings
Fm::FolderConfig::saveCache();
return true; return true;
} }
@ -562,4 +580,83 @@ void Settings::setTerminal(QString terminalCommand) {
} }
// per-folder settings
FolderSettings Settings::loadFolderSettings(Fm::Path path) const {
FolderSettings settings;
Fm::FolderConfig cfg(path);
// set defaults
settings.setSortOrder(sortOrder());
settings.setSortColumn(sortColumn());
settings.setViewMode(viewMode());
settings.setShowHidden(showHidden());
settings.setSortFolderFirst(sortFolderFirst());
settings.setSortCaseSensitive(sortCaseSensitive());
// columns?
if(!cfg.isEmpty()) {
// load folder-specific settings
settings.setCustomized(true);
char* str;
// load sorting
str = cfg.getString("SortOrder");
if(str != nullptr) {
settings.setSortOrder(sortOrderFromString(str));
g_free(str);
}
str = cfg.getString("SortColumn");
if(str != nullptr) {
settings.setSortColumn(sortColumnFromString(str));
g_free(str);
}
str = cfg.getString("ViewMode");
if(str != nullptr) {
// set view mode
settings.setViewMode(viewModeFromString(str));
g_free(str);
}
gboolean show_hidden;
if(cfg.getBoolean("ShowHidden", &show_hidden)) {
settings.setShowHidden(show_hidden);
}
gboolean folder_first;
if(cfg.getBoolean("SortFolderFirst", &folder_first)) {
settings.setSortFolderFirst(folder_first);
}
gboolean case_sensitive;
if(cfg.getBoolean("SortCaseSensitive", &case_sensitive)) {
settings.setSortCaseSensitive(case_sensitive);
}
}
return settings;
}
void Settings::saveFolderSettings(Fm::Path path, const FolderSettings& settings) {
if(!path.isNull()) {
// ensure that we have the libfm dir
QString dirName = xdgUserConfigDir() % QStringLiteral("/libfm");
QDir().mkpath(dirName); // if libfm config dir does not exist, create it
Fm::FolderConfig cfg(path);
cfg.setString("SortOrder", sortOrderToString(settings.sortOrder()));
cfg.setString("SortColumn", sortColumnToString(settings.sortColumn()));
cfg.setString("ViewMode", viewModeToString(settings.viewMode()));
cfg.setBoolean("ShowHidden", settings.showHidden());
cfg.setBoolean("SortFolderFirst", settings.sortFolderFirst());
cfg.setBoolean("SortCaseSensitive", settings.sortCaseSensitive());
}
}
void Settings::clearFolderSettings(Fm::Path path) const {
if(!path.isNull()) {
Fm::FolderConfig cfg(path);
cfg.purge();
}
}
} // namespace PCManFM } // namespace PCManFM

@ -38,6 +38,86 @@ enum OpenDirTargetType {
OpenInLastActiveWindow OpenInLastActiveWindow
}; };
class FolderSettings {
public:
FolderSettings():
isCustomized_(false),
sortOrder_(Qt::AscendingOrder),
sortColumn_(Fm::FolderModel::ColumnFileName),
viewMode_(Fm::FolderView::IconMode),
showHidden_(false),
sortFolderFirst_(true),
sortCaseSensitive_(true) {
}
bool isCustomized() const {
return isCustomized_;
}
void setCustomized(bool value) {
isCustomized_ = value;
}
Qt::SortOrder sortOrder() const {
return sortOrder_;
}
void setSortOrder(Qt::SortOrder value) {
sortOrder_ = value;
}
Fm::FolderModel::ColumnId sortColumn() const {
return sortColumn_;
}
void setSortColumn(Fm::FolderModel::ColumnId value) {
sortColumn_ = value;
}
Fm::FolderView::ViewMode viewMode() const {
return viewMode_;
}
void setViewMode(Fm::FolderView::ViewMode value) {
viewMode_ = value;
}
bool sortFolderFirst() const {
return sortFolderFirst_;
}
void setSortFolderFirst(bool value) {
sortFolderFirst_ = value;
}
bool showHidden() const {
return showHidden_;
}
void setShowHidden(bool value) {
showHidden_ = value;
}
bool sortCaseSensitive() const {
return sortCaseSensitive_;
}
void setSortCaseSensitive(bool value) {
sortCaseSensitive_ = value;
}
private:
bool isCustomized_;
Qt::SortOrder sortOrder_;
Fm::FolderModel::ColumnId sortColumn_;
Fm::FolderView::ViewMode viewMode_;
bool showHidden_;
bool sortFolderFirst_;
bool sortCaseSensitive_;
// columns?
};
class Settings : public QObject { class Settings : public QObject {
Q_OBJECT Q_OBJECT
public: public:
@ -50,6 +130,8 @@ public:
bool loadFile(QString filePath); bool loadFile(QString filePath);
bool saveFile(QString filePath); bool saveFile(QString filePath);
static QString xdgUserConfigDir();
QString profileDir(QString profile, bool useFallback = false); QString profileDir(QString profile, bool useFallback = false);
// setter/getter functions // setter/getter functions
@ -185,6 +267,14 @@ public:
desktopFont_ = font; desktopFont_ = font;
} }
int desktopIconSize() const {
return desktopIconSize_;
}
void setDesktopIconSize(int desktopIconSize) {
desktopIconSize_ = desktopIconSize;
}
bool showWmMenu() const { bool showWmMenu() const {
return showWmMenu_; return showWmMenu_;
} }
@ -217,6 +307,14 @@ public:
desktopSortColumn_ = desktopSortColumn; desktopSortColumn_ = desktopSortColumn;
} }
bool desktopSortFolderFirst() const {
return desktopSortFolderFirst_;
}
void setSesktopSortFolderFirst(bool desktopFolderFirst) {
desktopSortFolderFirst_ = desktopFolderFirst;
}
bool alwaysShowTabs() const { bool alwaysShowTabs() const {
return alwaysShowTabs_; return alwaysShowTabs_;
} }
@ -338,6 +436,15 @@ public:
showHidden_ = showHidden; showHidden_ = showHidden;
} }
bool sortCaseSensitive() const {
return sortCaseSensitive_;
}
void setSortCaseSensitive(bool value) {
sortCaseSensitive_ = value;
}
bool placesHome() const { bool placesHome() const {
return placesHome_; return placesHome_;
} }
@ -626,6 +733,12 @@ public:
fm_config->template_run_app = templateRunApp_; fm_config->template_run_app = templateRunApp_;
} }
// per-folder settings
FolderSettings loadFolderSettings(Fm::Path path) const;
void saveFolderSettings(Fm::Path path, const FolderSettings &settings);
void clearFolderSettings(Fm::Path path) const;
private: private:
QString profileName_; QString profileName_;
@ -649,11 +762,13 @@ private:
QColor desktopFgColor_; QColor desktopFgColor_;
QColor desktopShadowColor_; QColor desktopShadowColor_;
QFont desktopFont_; QFont desktopFont_;
int desktopIconSize_;
bool showWmMenu_; bool showWmMenu_;
bool desktopShowHidden_; bool desktopShowHidden_;
Qt::SortOrder desktopSortOrder_; Qt::SortOrder desktopSortOrder_;
Fm::FolderModel::ColumnId desktopSortColumn_; Fm::FolderModel::ColumnId desktopSortColumn_;
bool desktopSortFolderFirst_;
bool alwaysShowTabs_; bool alwaysShowTabs_;
bool showTabClose_; bool showTabClose_;
@ -673,6 +788,7 @@ private:
Qt::SortOrder sortOrder_; Qt::SortOrder sortOrder_;
Fm::FolderModel::ColumnId sortColumn_; Fm::FolderModel::ColumnId sortColumn_;
bool sortFolderFirst_; bool sortFolderFirst_;
bool sortCaseSensitive_;
bool showFilter_; bool showFilter_;
// settings for use with libfm // settings for use with libfm

@ -22,16 +22,18 @@
#include "launcher.h" #include "launcher.h"
#include <libfm-qt/filemenu.h> #include <libfm-qt/filemenu.h>
#include <libfm-qt/mountoperation.h> #include <libfm-qt/mountoperation.h>
#include <libfm-qt/proxyfoldermodel.h>
#include <libfm-qt/cachedfoldermodel.h>
#include <libfm-qt/fileinfo.h>
#include <QApplication> #include <QApplication>
#include <QCursor> #include <QCursor>
#include <QMessageBox> #include <QMessageBox>
#include <QScrollBar> #include <QScrollBar>
#include <libfm-qt/proxyfoldermodel.h>
#include "settings.h" #include "settings.h"
#include "application.h" #include "application.h"
#include <libfm-qt/cachedfoldermodel.h>
#include <QTimer> #include <QTimer>
#include <QTextStream> #include <QTextStream>
#include <QDebug>
using namespace Fm; using namespace Fm;
@ -48,14 +50,17 @@ bool ProxyFilter::filterAcceptsRow(const Fm::ProxyFolderModel* model, FmFileInfo
return true; return true;
} }
void ProxyFilter::setVirtHidden(FmFolder* folder) { void ProxyFilter::setVirtHidden(Fm::Folder folder) {
virtHiddenList_ = QStringList(); // reset the list virtHiddenList_ = QStringList(); // reset the list
if(!folder) return; if(folder.isNull())
if(FmPath* path = fm_folder_get_path(folder)) { return;
char* pathStr = fm_path_to_str(path); Fm::Path path = folder.getPath();
if(!path.isNull()) {
char* pathStr = path.toStr();
if(pathStr) { if(pathStr) {
QString dotHidden = QString(pathStr) + QString("/.hidden"); QString dotHidden = QString::fromUtf8(pathStr) + QString("/.hidden");
g_free(pathStr); g_free(pathStr);
// FIXME: this does not work for non-local filesystems
QFile file(dotHidden); QFile file(dotHidden);
if(file.open(QIODevice::ReadOnly | QIODevice::Text)) { if(file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&file); QTextStream in(&file);
@ -67,9 +72,8 @@ void ProxyFilter::setVirtHidden(FmFolder* folder) {
} }
} }
TabPage::TabPage(FmPath* path, QWidget* parent): TabPage::TabPage(Fm::Path path, QWidget* parent):
QWidget(parent), QWidget(parent),
folder_(NULL),
folderModel_(NULL), folderModel_(NULL),
overrideCursor_(false) { overrideCursor_(false) {
@ -79,7 +83,7 @@ TabPage::TabPage(FmPath* path, QWidget* parent):
proxyModel_ = new ProxyFolderModel(); proxyModel_ = new ProxyFolderModel();
proxyModel_->setShowHidden(settings.showHidden()); proxyModel_->setShowHidden(settings.showHidden());
proxyModel_->setShowThumbnails(settings.showThumbnails()); proxyModel_->setShowThumbnails(settings.showThumbnails());
connect(proxyModel_, &ProxyFolderModel::sortFilterChanged, this, &TabPage::onModelSortFilterChanged); connect(proxyModel_, &ProxyFolderModel::sortFilterChanged, this, &TabPage::sortFilterChanged);
verticalLayout = new QVBoxLayout(this); verticalLayout = new QVBoxLayout(this);
verticalLayout->setContentsMargins(0, 0, 0, 0); verticalLayout->setContentsMargins(0, 0, 0, 0);
@ -117,7 +121,11 @@ TabPage::~TabPage() {
} }
void TabPage::freeFolder() { void TabPage::freeFolder() {
if(folder_) { if(!folder_.isNull()) {
if(folderSettings_.isCustomized()) {
// save custom view settings for this folder
static_cast<Application*>(qApp)->settings().saveFolderSettings(folder_.getPath(), folderSettings_);
}
g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderStartLoading, this); g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderStartLoading, this);
g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderFinishLoading, this); g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderFinishLoading, this);
g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderError, this); g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderError, this);
@ -125,8 +133,7 @@ void TabPage::freeFolder() {
g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderRemoved, this); g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderRemoved, this);
g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderUnmount, this); g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderUnmount, this);
g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderContentChanged, this); g_signal_handlers_disconnect_by_func(folder_, (gpointer)onFolderContentChanged, this);
g_object_unref(folder_); folder_ = nullptr;
folder_ = NULL;
} }
} }
@ -165,8 +172,8 @@ void TabPage::restoreScrollPos() {
// if the current folder is the parent folder of the last browsed folder, // if the current folder is the parent folder of the last browsed folder,
// select the folder item in current view. // select the folder item in current view.
if(lastFolderPath_.parent() == path()) { if(!lastFolderPath_.isNull() && lastFolderPath_.getParent() == path()) {
QModelIndex index = folderView_->indexFromFolderPath(lastFolderPath_.data()); QModelIndex index = folderView_->indexFromFolderPath(lastFolderPath_);
if(index.isValid()) { if(index.isValid()) {
folderView_->childView()->scrollTo(index, QAbstractItemView::EnsureVisible); folderView_->childView()->scrollTo(index, QAbstractItemView::EnsureVisible);
folderView_->childView()->setCurrentIndex(index); folderView_->childView()->setCurrentIndex(index);
@ -276,8 +283,8 @@ void TabPage::restoreScrollPos() {
} }
QString TabPage::formatStatusText() { QString TabPage::formatStatusText() {
if(proxyModel_ && folder_) { if(proxyModel_ && !folder_.isNull()) {
FmFileInfoList* files = fm_folder_get_files(folder_); Fm::FileInfoList files = folder_.getFiles();
int total_files = fm_file_info_list_get_length(files); int total_files = fm_file_info_list_get_length(files);
int shown_files = proxyModel_->rowCount(); int shown_files = proxyModel_->rowCount();
int hidden_files = total_files - shown_files; int hidden_files = total_files - shown_files;
@ -300,7 +307,7 @@ QString TabPage::formatStatusText() {
if(settings.closeOnUnmount()) if(settings.closeOnUnmount())
QTimer::singleShot(0, pThis, SLOT(deleteLater())); QTimer::singleShot(0, pThis, SLOT(deleteLater()));
else else
pThis->chdir(fm_path_get_home()); pThis->chdir(Fm::Path::getHome());
} }
/*static*/ void TabPage::onFolderUnmount(FmFolder* _folder, TabPage* pThis) { /*static*/ void TabPage::onFolderUnmount(FmFolder* _folder, TabPage* pThis) {
@ -318,7 +325,7 @@ QString TabPage::formatStatusText() {
if(settings.closeOnUnmount()) if(settings.closeOnUnmount())
QTimer::singleShot(0, pThis, SLOT(deleteLater())); QTimer::singleShot(0, pThis, SLOT(deleteLater()));
else else
pThis->chdir(fm_path_get_home()); pThis->chdir(Fm::Path::getHome());
} }
/*static */ void TabPage::onFolderContentChanged(FmFolder* _folder, TabPage* pThis) { /*static */ void TabPage::onFolderContentChanged(FmFolder* _folder, TabPage* pThis) {
@ -328,20 +335,20 @@ QString TabPage::formatStatusText() {
} }
QString TabPage::pathName() { QString TabPage::pathName() {
char* disp_path = fm_path_display_name(path(), TRUE); char* disp_path = path().displayName(true);
QString ret = QString::fromUtf8(disp_path); QString ret = QString::fromUtf8(disp_path);
g_free(disp_path); g_free(disp_path);
return ret; return ret;
} }
void TabPage::chdir(FmPath* newPath, bool addHistory) { void TabPage::chdir(Path newPath, bool addHistory) {
if(folder_) { if(!folder_.isNull()) {
// we're already in the specified dir // we're already in the specified dir
if(fm_path_equal(newPath, fm_folder_get_path(folder_))) if(newPath == fm_folder_get_path(folder_))
return; return;
// remember the previous folder path that we have browsed. // remember the previous folder path that we have browsed.
lastFolderPath_ = fm_folder_get_path(folder_); lastFolderPath_ = folder_.getPath();
if(addHistory) { if(addHistory) {
// store current scroll pos in the browse history // store current scroll pos in the browse history
@ -360,12 +367,12 @@ void TabPage::chdir(FmPath* newPath, bool addHistory) {
freeFolder(); freeFolder();
} }
char* disp_name = fm_path_display_basename(newPath); char* disp_name = newPath.displayBasename();
title_ = QString::fromUtf8(disp_name); title_ = QString::fromUtf8(disp_name);
Q_EMIT titleChanged(title_); Q_EMIT titleChanged(title_);
g_free(disp_name); g_free(disp_name);
folder_ = fm_folder_from_path(newPath); folder_ = Fm::Folder::fromPath(newPath);
proxyFilter_->setVirtHidden(folder_); proxyFilter_->setVirtHidden(folder_);
if(addHistory) { if(addHistory) {
// add current path to browse history // add current path to browse history
@ -381,13 +388,19 @@ void TabPage::chdir(FmPath* newPath, bool addHistory) {
g_signal_connect(folder_, "content-changed", G_CALLBACK(onFolderContentChanged), this); g_signal_connect(folder_, "content-changed", G_CALLBACK(onFolderContentChanged), this);
folderModel_ = CachedFolderModel::modelFromFolder(folder_); folderModel_ = CachedFolderModel::modelFromFolder(folder_);
proxyModel_->setSourceModel(folderModel_);
proxyModel_->sort(proxyModel_->sortColumn(), proxyModel_->sortOrder()); // set sorting, considering customized folders
Settings& settings = static_cast<Application*>(qApp)->settings(); Settings& settings = static_cast<Application*>(qApp)->settings();
proxyModel_->setFolderFirst(settings.sortFolderFirst()); folderSettings_ = settings.loadFolderSettings(path());
proxyModel_->sort(settings.sortColumn(), settings.sortOrder()); proxyModel_->sort(folderSettings_.sortColumn(), folderSettings_.sortOrder());
proxyModel_->setFolderFirst(folderSettings_.sortFolderFirst());
proxyModel_->setShowHidden(folderSettings_.showHidden());
proxyModel_->setSortCaseSensitivity(folderSettings_.sortCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive);
proxyModel_->setSourceModel(folderModel_);
if(fm_folder_is_loaded(folder_)) { folderView_->setViewMode(folderSettings_.viewMode());
if(folder_.isLoaded()) {
onFolderStartLoading(folder_, this); onFolderStartLoading(folder_, this);
onFolderFinishLoading(folder_, this); onFolderFinishLoading(folder_, this);
onFolderFsInfo(folder_, this); onFolderFsInfo(folder_, this);
@ -414,39 +427,43 @@ void TabPage::onSelChanged(int numSel) {
if(numSel > 0) { if(numSel > 0) {
/* FIXME: display total size of all selected files. */ /* FIXME: display total size of all selected files. */
if(numSel == 1) { /* only one file is selected */ if(numSel == 1) { /* only one file is selected */
FmFileInfoList* files = folderView_->selectedFiles(); Fm::FileInfoList files = folderView_->selectedFiles();
FmFileInfo* fi = fm_file_info_list_peek_head(files); if(!files.isNull()) {
const char* size_str = fm_file_info_get_disp_size(fi); Fm::FileInfo fi = fm_file_info_list_peek_head(files);
const char* size_str = fi.getDispSize();
if(size_str) { if(size_str) {
msg = QString("\"%1\" (%2) %3") msg = QString("\"%1\" (%2) %3")
.arg(QString::fromUtf8(fm_file_info_get_disp_name(fi))) .arg(QString::fromUtf8(fi.getDispName()))
.arg(QString::fromUtf8(size_str ? size_str : "")) .arg(QString::fromUtf8(size_str))
.arg(QString::fromUtf8(fm_file_info_get_desc(fi))); .arg(QString::fromUtf8(fi.getDesc()));
} }
else { else {
msg = QString("\"%1\" %2") msg = QString("\"%1\" %2")
.arg(QString::fromUtf8(fm_file_info_get_disp_name(fi))) .arg(QString::fromUtf8(fi.getDispName()))
.arg(QString::fromUtf8(fm_file_info_get_desc(fi))); .arg(QString::fromUtf8(fi.getDesc()));
} }
/* FIXME: should we support statusbar plugins as in the gtk+ version? */ /* FIXME: should we support statusbar plugins as in the gtk+ version? */
fm_file_info_list_unref(files); }
} }
else { else {
goffset sum; goffset sum;
GList* l; GList* l;
msg = tr("%1 item(s) selected", NULL, numSel).arg(numSel); msg = tr("%n item(s) selected", nullptr, numSel);
/* don't count if too many files are selected, that isn't lightweight */ /* don't count if too many files are selected, that isn't lightweight */
if(numSel < 1000) { if(numSel < 1000) {
sum = 0; sum = 0;
FmFileInfoList* files = folderView_->selectedFiles(); Fm::FileInfoList files = folderView_->selectedFiles();
for(l = fm_file_info_list_peek_head_link(files); l; l = l->next) { if(!files.isNull()) {
if(fm_file_info_is_dir(FM_FILE_INFO(l->data))) { for(l = files.peekHeadLink(); l; l = l->next) {
Fm::FileInfo fi = FM_FILE_INFO(l->data);
if(fi.isDir()) {
/* if we got a directory then we cannot tell it's size /* if we got a directory then we cannot tell it's size
unless we do deep count but we cannot afford it */ unless we do deep count but we cannot afford it */
sum = -1; sum = -1;
break; break;
} }
sum += fm_file_info_get_size(FM_FILE_INFO(l->data)); sum += fi.getSize();
}
} }
if(sum >= 0) { if(sum >= 0) {
char size_str[128]; char size_str[128];
@ -455,7 +472,6 @@ void TabPage::onSelChanged(int numSel) {
msg += QString(" (%1)").arg(QString::fromUtf8(size_str)); msg += QString(" (%1)").arg(QString::fromUtf8(size_str));
} }
/* FIXME: should we support statusbar plugins as in the gtk+ version? */ /* FIXME: should we support statusbar plugins as in the gtk+ version? */
fm_file_info_list_unref(files);
} }
/* FIXME: can we show some more info on selection? /* FIXME: can we show some more info on selection?
that isn't lightweight if a lot of files are selected */ that isn't lightweight if a lot of files are selected */
@ -500,28 +516,74 @@ void TabPage::jumpToHistory(int index)
} }
bool TabPage::canUp() { bool TabPage::canUp() {
return (path() != NULL && fm_path_get_parent(path()) != NULL); Fm::Path _path = path();
return (!_path.isNull() && !_path.getParent().isNull());
} }
void TabPage::up() { void TabPage::up() {
FmPath* _path = path(); Fm::Path _path = path();
if(_path) { if(!_path.isNull()) {
FmPath* parent = fm_path_get_parent(_path); Fm::Path parent = _path.getParent();
if(parent) { if(!parent.isNull()) {
chdir(parent, true); chdir(parent, true);
} }
} }
} }
void TabPage::onModelSortFilterChanged() {
Q_EMIT sortFilterChanged();
}
void TabPage::updateFromSettings(Settings& settings) { void TabPage::updateFromSettings(Settings& settings) {
folderView_->updateFromSettings(settings); folderView_->updateFromSettings(settings);
} }
void TabPage::setViewMode(Fm::FolderView::ViewMode mode) {
if(folderSettings_.viewMode() != mode) {
folderSettings_.setViewMode(mode);
if(folderSettings_.isCustomized()) {
static_cast<Application*>(qApp)->settings().saveFolderSettings(path(), folderSettings_);
}
}
folderView_->setViewMode(mode);
}
void TabPage::sort(int col, Qt::SortOrder order) {
if(folderSettings_.sortColumn() != col || folderSettings_.sortOrder() != order) {
folderSettings_.setSortColumn(Fm::FolderModel::ColumnId(col));
folderSettings_.setSortOrder(order);
if(folderSettings_.isCustomized()) {
static_cast<Application*>(qApp)->settings().saveFolderSettings(path(), folderSettings_);
}
}
if(proxyModel_)
proxyModel_->sort(col, order);
}
void TabPage::setSortFolderFirst(bool value) {
if(folderSettings_.sortFolderFirst() != value) {
folderSettings_.setSortFolderFirst(value);
if(folderSettings_.isCustomized()) {
static_cast<Application*>(qApp)->settings().saveFolderSettings(path(), folderSettings_);
}
}
proxyModel_->setFolderFirst(value);
}
void TabPage::setSortCaseSensitive(bool value) {
if(folderSettings_.sortCaseSensitive() != value) {
folderSettings_.setSortCaseSensitive(value);
if(folderSettings_.isCustomized()) {
static_cast<Application*>(qApp)->settings().saveFolderSettings(path(), folderSettings_);
}
}
proxyModel_->setSortCaseSensitivity(value ? Qt::CaseSensitive : Qt::CaseInsensitive);
}
void TabPage::setShowHidden(bool showHidden) { void TabPage::setShowHidden(bool showHidden) {
if(folderSettings_.showHidden() != showHidden) {
folderSettings_.setShowHidden(showHidden);
if(folderSettings_.isCustomized()) {
static_cast<Application*>(qApp)->settings().saveFolderSettings(path(), folderSettings_);
}
}
if(!proxyModel_ || showHidden == proxyModel_->showHidden()) if(!proxyModel_ || showHidden == proxyModel_->showHidden())
return; return;
proxyModel_->setShowHidden(showHidden); proxyModel_->setShowHidden(showHidden);
@ -529,11 +591,30 @@ void TabPage::setShowHidden(bool showHidden) {
Q_EMIT statusChanged(StatusTextNormal, statusText_[StatusTextNormal]); Q_EMIT statusChanged(StatusTextNormal, statusText_[StatusTextNormal]);
} }
void TabPage:: applyFilter() { void TabPage::applyFilter() {
if(!proxyModel_) return; if(!proxyModel_)
return;
proxyModel_->updateFilters(); proxyModel_->updateFilters();
statusText_[StatusTextNormal] = formatStatusText(); statusText_[StatusTextNormal] = formatStatusText();
Q_EMIT statusChanged(StatusTextNormal, statusText_[StatusTextNormal]); Q_EMIT statusChanged(StatusTextNormal, statusText_[StatusTextNormal]);
} }
void TabPage::setCustomizedView(bool value) {
if(folderSettings_.isCustomized() == value)
return;
Settings& settings = static_cast<Application*>(qApp)->settings();
folderSettings_.setCustomized(value);
if(value) { // save customized folder view settings
settings.saveFolderSettings(path(), folderSettings_);
}
else { // use default folder view settings
settings.clearFolderSettings(path());
setShowHidden(settings.showHidden());
setSortCaseSensitive(settings.sortCaseSensitive());
setSortFolderFirst(settings.sortFolderFirst());
sort(settings.sortColumn(), settings.sortOrder());
}
}
} // namespace PCManFM } // namespace PCManFM

@ -27,6 +27,9 @@
#include <libfm-qt/browsehistory.h> #include <libfm-qt/browsehistory.h>
#include "view.h" #include "view.h"
#include <libfm-qt/path.h> #include <libfm-qt/path.h>
#include <libfm-qt/folder.h>
#include <libfm-qt/fileinfo.h>
#include "settings.h"
namespace Fm { namespace Fm {
class FileLauncher; class FileLauncher;
@ -37,14 +40,13 @@ namespace Fm {
namespace PCManFM { namespace PCManFM {
class Settings;
class Launcher; class Launcher;
class ProxyFilter : public Fm::ProxyFolderModelFilter { class ProxyFilter : public Fm::ProxyFolderModelFilter {
public: public:
bool filterAcceptsRow(const Fm::ProxyFolderModel* model, FmFileInfo* info) const; bool filterAcceptsRow(const Fm::ProxyFolderModel* model, FmFileInfo* info) const;
virtual ~ProxyFilter() {} virtual ~ProxyFilter() {}
void setVirtHidden(FmFolder* folder); void setVirtHidden(Fm::Folder folder);
QString getFilterStr() { QString getFilterStr() {
return filterStr_; return filterStr_;
} }
@ -69,61 +71,51 @@ public:
}; };
public: public:
explicit TabPage(FmPath* path, QWidget* parent = nullptr); explicit TabPage(Fm::Path path, QWidget* parent = nullptr);
virtual ~TabPage(); virtual ~TabPage();
void chdir(FmPath* newPath, bool addHistory = true); void chdir(Fm::Path newPath, bool addHistory = true);
Fm::FolderView::ViewMode viewMode() { Fm::FolderView::ViewMode viewMode() {
return folderView_->viewMode(); return folderSettings_.viewMode();
} }
void setViewMode(Fm::FolderView::ViewMode mode) { void setViewMode(Fm::FolderView::ViewMode mode);
folderView_->setViewMode(mode);
}
void sort(int col, Qt::SortOrder order = Qt::AscendingOrder) { void sort(int col, Qt::SortOrder order = Qt::AscendingOrder);
// if(folderModel_)
// folderModel_->sort(col, order);
if(proxyModel_)
proxyModel_->sort(col, order);
}
int sortColumn() { int sortColumn() {
return proxyModel_->sortColumn(); return folderSettings_.sortColumn();
} }
Qt::SortOrder sortOrder() { Qt::SortOrder sortOrder() {
return proxyModel_->sortOrder(); return folderSettings_.sortOrder();
} }
bool sortFolderFirst() { bool sortFolderFirst() {
return proxyModel_->folderFirst(); return folderSettings_.sortFolderFirst();
}
void setSortFolderFirst(bool value) {
proxyModel_->setFolderFirst(value);
} }
void setSortFolderFirst(bool value);
bool sortCaseSensitive() { bool sortCaseSensitive() {
return proxyModel_->sortCaseSensitivity(); return folderSettings_.sortCaseSensitive();
}
void setSortCaseSensitive(bool value) {
proxyModel_->setSortCaseSensitivity(value ? Qt::CaseSensitive : Qt::CaseInsensitive);
} }
void setSortCaseSensitive(bool value);
bool showHidden() { bool showHidden() {
return proxyModel_->showHidden(); return folderSettings_.showHidden();
} }
void setShowHidden(bool showHidden); void setShowHidden(bool showHidden);
FmPath* path() { Fm::Path path() {
return folder_ ? fm_folder_get_path(folder_) : nullptr; return Fm::Path(!folder_.isNull() ? folder_.getPath() : nullptr);
} }
QString pathName(); QString pathName();
FmFolder* folder() { Fm::Folder& folder() {
return folder_; return folder_;
} }
@ -139,11 +131,11 @@ public:
return history_; return history_;
} }
FmFileInfoList* selectedFiles() { Fm::FileInfoList selectedFiles() {
return folderView_->selectedFiles(); return folderView_->selectedFiles();
} }
FmPathList* selectedFilePaths() { Fm::PathList selectedFilePaths() {
return folderView_->selectedFilePaths(); return folderView_->selectedFilePaths();
} }
@ -152,9 +144,9 @@ public:
void invertSelection(); void invertSelection();
void reload() { void reload() {
if(folder_) { if(!folder_.isNull()) {
proxyFilter_->setVirtHidden(folder_); // reread ".hidden" proxyFilter_->setVirtHidden(folder_); // reread ".hidden"
fm_folder_reload(folder_); folder_.reload();
} }
} }
@ -207,6 +199,12 @@ public:
void applyFilter(); void applyFilter();
bool hasCustomizedView() {
return folderSettings_.isCustomized();
}
void setCustomizedView(bool value);
Q_SIGNALS: Q_SIGNALS:
void statusChanged(int type, QString statusText); void statusChanged(int type, QString statusText);
void titleChanged(QString title); void titleChanged(QString title);
@ -217,7 +215,6 @@ Q_SIGNALS:
protected Q_SLOTS: protected Q_SLOTS:
void onOpenDirRequested(FmPath* path, int target); void onOpenDirRequested(FmPath* path, int target);
void onModelSortFilterChanged();
void onSelChanged(int numSel); void onSelChanged(int numSel);
void restoreScrollPos(); void restoreScrollPos();
@ -239,12 +236,13 @@ private:
Fm::ProxyFolderModel* proxyModel_; Fm::ProxyFolderModel* proxyModel_;
ProxyFilter* proxyFilter_; ProxyFilter* proxyFilter_;
QVBoxLayout* verticalLayout; QVBoxLayout* verticalLayout;
FmFolder* folder_; Fm::Folder folder_;
QString title_; QString title_;
QString statusText_[StatusTextNum]; QString statusText_[StatusTextNum];
Fm::BrowseHistory history_; // browsing history Fm::BrowseHistory history_; // browsing history
Fm::Path lastFolderPath_; // last browsed folder Fm::Path lastFolderPath_; // last browsed folder
bool overrideCursor_; bool overrideCursor_;
FolderSettings folderSettings_;
}; };
} }

@ -0,0 +1,4 @@
#Translations
Name[ar]=سطح المكتب
GenericName[ar]=تفضيلات سطح المكتب
Comment[ar]=غيّر خلفيّات مدير سطح المكتب وسلوكه

File diff suppressed because it is too large Load Diff

@ -0,0 +1,4 @@
#Translations
Name[ar]=مدير الملفّات PCManFM
GenericName[ar]=مدير ملفّات
Comment[ar]=تصفّح نظام الملفّات وأدر ملفّاتك

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -70,8 +70,8 @@ void View::onOpenInTerminal() {
Application* app = static_cast<Application*>(qApp); Application* app = static_cast<Application*>(qApp);
Fm::FileMenu* menu = static_cast<Fm::FileMenu*>(sender()->parent()); Fm::FileMenu* menu = static_cast<Fm::FileMenu*>(sender()->parent());
for(GList* l = fm_file_info_list_peek_head_link(menu->files()); l; l = l->next) { for(GList* l = fm_file_info_list_peek_head_link(menu->files()); l; l = l->next) {
FmFileInfo* file = FM_FILE_INFO(l->data); Fm::FileInfo file = FM_FILE_INFO(l->data);
app->openFolderInTerminal(fm_file_info_get_path(file)); app->openFolderInTerminal(file.getPath());
} }
} }
@ -88,12 +88,12 @@ void View::prepareFileMenu(Fm::FileMenu* menu) {
// add some more menu items for dirs // add some more menu items for dirs
bool all_native = true; bool all_native = true;
bool all_directory = true; bool all_directory = true;
FmFileInfoList* files = menu->files(); Fm::FileInfoList files = menu->files();
for(GList* l = fm_file_info_list_peek_head_link(files); l; l = l->next) { for(GList* l = files.peekHeadLink(); l; l = l->next) {
FmFileInfo* fi = FM_FILE_INFO(l->data); Fm::FileInfo fi = FM_FILE_INFO(l->data);
if(!fm_file_info_is_dir(fi)) if(!fi.isDir())
all_directory = false; all_directory = false;
else if(fm_file_info_is_dir(fi) && !fm_file_info_is_native(fi)) else if(fi.isDir() && !fi.isNative())
all_native = false; all_native = false;
} }

Loading…
Cancel
Save