Cherry-picking upstream release 0.11.1.

* Syncded debian foo with experimental
* Bump compat to 10
* Removed --parallel from rules, standard compat 10
* Bumped Standards to 3.9.8, no changes needed
* Bump minimum version debhelper (>= 10)
* Bump minimum version libqt5xdg-dev (>= 2.0.0)
* Re-introduce build dependency liblxqt0-dev (>= 0.11.0)
* Added build dependency libqt5svg5-dev
* Added Recommends libfm-qt-l10n
* Exported LC_ALL=C.UTF-8 - define language settings for reproducible
  builds
* Hard override translation control
* Use DCMAKE_BUILD_TYPE=RelWithDebInfo
* Fixed copyright Format field, using https
* Fixed copyrights, removed obsolete files
* Fixed libfm-qt3.install, don't install translations
ubuntu/cosmic debian/0.11.1-2
Alf Gaida 8 years ago
parent f2b1f23fdf
commit 5b9cc02532

1
.gitignore vendored

@ -1,4 +1,5 @@
build*/
src/translations/libfm-qt
# Vim.gitignore
[._]*.s[a-w][a-z]

@ -3,4 +3,4 @@ Upstream Authors:
Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
Copyright:
Copyright (c) 2013-2015 LXQt team
Copyright (c) 2013-2016 LXQt team

@ -0,0 +1,344 @@
libfm-qt-0.11.1 / 2016-09-24
============================
* Bump version to 0.11.1 (#39)
* Fix Custom Actions Submenu (#38)
* Extend README.md
* Add C++ wrappers for libfm C APIs.
* Correct positioning of small icons in icon/thumbnail mode (#32)
* Silence new compiler warnings (#36)
* Adapt to QT_USE_QSTRINGBUILDER macro
* Fixes xcb linking error
* Use LXQtCompilerSettings cmake module
* Replaces deprecated QStyleOptionViewItemV4
* Fix item text direction with RTL layout (#33)
* Set tabstops for mount operation password dialog (#31)
* Fix memory leak in file open menu (#29)
* Fixes https://github.com/lxde/pcmanfm-qt/issues/351. (#27)
* build: Use external translations
* ts-file removal (#26)
* Fix memory leaks in file menu (#25)
* Merge pull request #24 from philippwiesemann/fix-folder-menu-leak
* translations: fix four typos in messages (#23)
* Fix memory leak if restoring files from trash
* Fix rename dialog displaying source info twice
* Enable renaming in Properties dialog Fixes https://github.com/lxde/pcmanfm-qt/issues/324.
* Cancel indexing job when closing filepropsdialog
* Bump year
0.11.0 / 2016-02-27
===================
* Bump version number and ABI version and preparing for the initial release.
* Redirect focus operation on the folderview to the actual widget
* Use grid layout to have proper properties alignment
* Focus automatically on the first field of the filesearch dialog
* Add (folder) custom actions to foldermenu.
* Update czech translation (by Petr Balíček <pbalicek@seznam.cz>)
* Fix compiling with Qt < 5.4
* Add supports for freedesktop Xdnd direct save (XDS) protocol (closes #pcmanfm-qt/298). * Move Xdnd workarounds from pcmanfm-qt to libfm-qt.
* Protected FolderView methods for getting and setting item delegate margins
* Perform auto-completion for the path bar when the user press Tab key. This closes pcmanfm-qt/#201.
* Disable unused options in file search dialog
* Let the style engine draw the text selection rectangle.
* Fix file search with smaller than option
* Fix target language in Lithuanian translation file
* Fix memory leak if reading stream for image failed
* Update German translation
* Polish translation updated
* Polish translation updated
* Add a missing type casting to fix a compiler warning.
* Relicense libfm-qt to LGPL v.2.1.
* Avoid using blocking calls when initializing the trash can to speed up startup.
* Updated Russian translation Removed ru_RU file
* Create DnD menu with supported actions only
* make createAction public so can be hidden from view
* Adds Runtime and Devel install COMPONENT
* Quote everything that could break due to whitespaces
* Use CMake GenerateExportHeader to generate ABI header file
* Use no exceptions also with Clang
* Uses CMAKE_VISIBILITY and CMAKE_CXX_VISIBILITY flags
* Use QString() instead of ""
* Fix duplicated mtp mounts in the side pane by adding workarounds for potential bugs of gvfs.
* Replace g_io_scheduler which is deprecated with QThread in Fm::PathEdit. * Fix compiler warnings.
* Adds .gitignore
* Makes Release the default BUILD_TYPE
* Adds INSTALL package configuration file
* Removes XCB from the dependencies
* Adds target_include_directories() for the INSTALL_INTERFACE.
* Removes CMAKE_CURRENT_BINARY_DIR usage
* Removes QTX_INCLUDE_DIRS
* Removes Qt Creator .user file
* Updates libraries dependencies
* Adds REQUIRED_PACKAGE_VERSION variables
* Adds generation of TARGETS CMake file
* Creates and installs an package version file
* Renames and moves LIBRARY_NAME variable to the top CMakeLists
* Removes sub-project
* Rename the library to libfm-qt and fix installed header files.
* Split pcmanfm-qt into two parts and move libfm-qt to its own repository.
* Update French translation
* Italian translation updates
* 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.)
* 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
* hu translations updated
* Fixed several problems with item selection and alignment
* Remove unnecessary qDebug traces
* Update translations.
* 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.
* Update translations
* 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
* PlacesView: activate on click on the second column
* SidePane: reduce size of button's column width
* Added a filterbar + Handle virtually hidden files
* Russian translation update
* Update cs_CZ translation with the strings provided by petrbal in pull request #218.
* 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 #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)
* Check for null pointers.
* Select the folder from where we have gone up.
* 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
* Update German translation
* 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.
* Create New menu actions, context menu in tree side pane, #163.
* Store side pane mode setting, #157.
* Fixes an translation regression
* Updates translations
* Uses LXQt lxqt_translate_ts() to handle translations
* 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.
* 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.
* Hungarian translation
* Fix #627 - long startup time. (This blocking is caused by checking the availability of "network:///".)
* Enable text selection in file properties dialog
* 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.
* Polish translations added
* 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.
* Add more null checks.
* 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.
* 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.
* 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.
* Support linguistic sorting of file names. This fixes #105.
* Update the folder model & view after files are changed.
* Open folders in new tabs by middle clicking on items in the side pane.
* 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.
* Add spanish translations
* Update Japanese translation
* Add German translation
* add Japanese translation
* Implement "UnTrash" for files in trash:/// and close lxde/lxqt#136.
* 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
* 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.: 364 of 364 strings translated (0 need review).
* New files added from LXDE Pootle server based on templates
* Add cs_CZ translation for libfm-qt.
* 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).
* Bump package version number and library soversion to prepare for 0.2 release.
* 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.
* 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.
* New files added from LXDE Pootle server based on templates
* New files added from LXDE Pootle server based on templates
* Improve update of translations to avoid unnecessary regeneration of ts files.
* Improve handling of fallback icons. This closes bug #57.
* Translations are lost accidentally in a previous commit. Restore them all.
* Fix a crash in Fm::PlacesModel when gvfs is not available. This closes bug #35 - Ctrl+W closes all windows.
* 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.
* Fix bug #80 - make execute in context menu doesn't do change permissions.
* Revert "fixed selection issue #45" This patch breaks copying files by DND in icon view mode and moving desktop icons.
* Use qss instead of QPalette to set the background color of ColorButton. This fixed bug #192 of lxde-qt.
* Rename the library from libfm-qt to libfm-qt5 when built with Qt5.
* fixed selection issue #45
* 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
* Make sure clang compiler does not complain
* Install pkgconfig file of libfm-qt to correct location in FreeBSD
* Fix missing return values in several methods.
* Avoid endless popups of error dialogs when there are errors launching files.
* Save thumbnails as png files correctly.
* Remember custom positions for desktop icons and fix #29.
* 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.
* 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.
* 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
* 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.
* Add a wrapper class Fm::Path for FmPath C struct.
* 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
* 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.
* Add "Empty trash" and fix a memory leak.
* Fix memory leaks for bookmarks. Fix the broken "Network" item in places.
* 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".
* 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.
* 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.
* Trivial fix.
* Add additional custom filter support to ProxyFolderModel.
* 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.
* Add soname 0.0.0 for libfm-qt, preparing for 0.1 release.
* Fix crashes caused by incorrect deletion of dialog objects.
* Enable thumbnail related settings.
* Update zh_TW translations and translation templates.
* Add Portuguese translation (pt).
* Add Lithuanian translation (lt_LT).
* 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.
* Fix a crash caused by accessing data for invalid model index.
* Add basic thumbnail support (need the latest thumbnail branch of libfm).
* 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".
* 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 a pkgconfig file for libfm-qt for use in other projects.
* 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.
* 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. Change base class of SidePane to QWidget.
* 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.
* 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.
* Move files for libfm-qt and pcmanfm-qt to separate subdirs.

@ -5,7 +5,7 @@ set(LIBFM_QT_LIBRARY_NAME "fm-qt" CACHE STRING "fm-qt")
set(LIBFM_QT_VERSION_MAJOR 0)
set(LIBFM_QT_VERSION_MINOR 11)
set(LIBFM_QT_VERSION_PATCH 0)
set(LIBFM_QT_VERSION_PATCH 1)
set(LIBFM_QT_VERSION ${LIBFM_QT_VERSION_MAJOR}.${LIBFM_QT_VERSION_MINOR}.${LIBFM_QT_VERSION_PATCH})
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
@ -32,13 +32,16 @@ endif()
find_package(Qt5Widgets "${REQUIRED_QT_VERSION}" REQUIRED)
find_package(Qt5LinguistTools "${REQUIRED_QT_VERSION}" REQUIRED)
find_package(Qt5X11Extras "${REQUIRED_QT_VERSION}" REQUIRED)
find_package(XCB REQUIRED)
#Note: no run-time dependency on liblxqt, just a build dependency for lxqt_translate_ts/desktop
find_package(lxqt REQUIRED)
find_package(PkgConfig)
pkg_check_modules(SYSTEM_LIBS REQUIRED
glib-2.0
gio-2.0
gio-unix-2.0
xcb
)
pkg_check_modules(LIBFM REQUIRED libfm>="${REQUIRED_LIBFM_VERSION}")
@ -50,6 +53,7 @@ include(GenerateExportHeader)
include(CMakePackageConfigHelpers)
include(LXQtTranslateTs)
include(LXQtTranslateDesktop)
include(LXQtCompilerSettings NO_POLICY_SCOPE)
add_definitions(-DQT_NO_KEYWORDS)
@ -57,27 +61,6 @@ add_definitions(-DQT_NO_KEYWORDS)
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(CMAKE_CXX_FLAGS "-fno-exceptions ${CMAKE_CXX_FLAGS}")
endif()
set(CMAKE_AUTOMOC TRUE)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

@ -1,21 +1,27 @@
# libfm-qt
Includes libfm-qt, the Qt port of the libfm - a library providing components to
build desktop file managers.
## Overview
Issue tracker:
https://github.com/lxde/pcmanfm-qt/issues
libfm-qt is the Qt port of libfm, a library providing components to build desktop file managers which belongs to [LXDE](http://lxde.org).
LXQt website:
http://lxqt.org
libfm-qt is licensed under the terms of the [LGPLv2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) or any later version. See file LICENSE for its full text.
LXDE website:
http://lxde.org
## Installation
### Compiling source code
# License
Runtime dependencies are qtx11extras and libfm ≥ 1,2 (not all features are provided by libfm-qt yet).
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.
libfm-qt is licensed under the terms of the
[LGPLv2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) or any later version.
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.
See the LICENSE file for the full text of the license.
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) and openSUSE (Leap 42.1 and Tumbleweed).
The library is still missing in Fedora which is providing version 0.10.0 of PCManFM-Qt only so far. This version was still including the code outsourced into libfm-qt later so libfm-qt will have to be provided by Fedora, too, as soon as the distribution upgrades to PCManFM-Qt ≥ 0.10.1.
## Development
Issues should go to the tracker of PCManFM-Qt at https://github.com/lxde/pcmanfm-qt/issues.

@ -0,0 +1,53 @@
#.rst:
# FindXCB
# -------
#
# Find XCB libraries
#
# Tries to find xcb libraries on unix systems.
#
# - Be sure to set the COMPONENTS to the components you want to link to
# - The XCB_LIBRARIES variable is set ONLY to your COMPONENTS list
# - To use only a specific component check the XCB_LIBRARIES_${COMPONENT} variable
#
# The following values are defined
#
# ::
#
# XCB_FOUND - True if xcb is available
# XCB_INCLUDE_DIRS - Include directories for xcb
# XCB_LIBRARIES - List of libraries for xcb
# XCB_DEFINITIONS - List of definitions for xcb
#
#=============================================================================
# Copyright (c) 2015 Jari Vetoniemi
#
# Distributed under the OSI-approved BSD License (the "License");
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
include(FeatureSummary)
set_package_properties(XCB PROPERTIES
URL "http://xcb.freedesktop.org/"
DESCRIPTION "X protocol C-language Binding")
find_package(PkgConfig)
pkg_check_modules(PC_XCB QUIET xcb ${XCB_FIND_COMPONENTS})
find_library(XCB_LIBRARIES xcb HINTS ${PC_XCB_LIBRARY_DIRS})
find_path(XCB_INCLUDE_DIRS xcb/xcb.h PATH_SUFFIXES xcb HINTS ${PC_XCB_INCLUDE_DIRS})
foreach(COMPONENT ${XCB_FIND_COMPONENTS})
find_library(XCB_LIBRARIES_${COMPONENT} ${COMPONENT} HINTS ${PC_XCB_LIBRARY_DIRS})
list(APPEND XCB_LIBRARIES ${XCB_LIBRARIES_${COMPONENT}})
mark_as_advanced(XCB_LIBRARIES_${COMPONENT})
endforeach(COMPONENT ${XCB_FIND_COMPONENTS})
set(XCB_DEFINITIONS ${PC_XCB_CFLAGS_OTHER})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIRS)
mark_as_advanced(XCB_INCLUDE_DIRS XCB_LIBRARIES XCB_DEFINITIONS)

@ -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 -v "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
COMMAND grep -h ${_pattern} ${_translations} >> ${_outFile}
COMMENT "Generating ${_fileName}${_fileExt}"
)
else()
add_custom_command(OUTPUT ${_outFile}
COMMAND grep -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()

6
debian/.gitignore vendored

@ -3,8 +3,8 @@
/*.substvars
/files
/mangled
/debhelper-build-stamp
/libfm-qt5-2/
/libfm-qt5-dev/
/libfm-qt5-dbg/
/libfm-qt3/
/libfm-qt-dev/
/tmp

22
debian/changelog vendored

@ -1,3 +1,25 @@
libfm-qt (0.11.1-2) unstable; urgency=medium
* Cherry-picking upstream release 0.11.1.
* Syncded debian foo with experimental
* Bump compat to 10
* Removed --parallel from rules, standard compat 10
* Bumped Standards to 3.9.8, no changes needed
* Bump minimum version debhelper (>= 10)
* Bump minimum version libqt5xdg-dev (>= 2.0.0)
* Re-introduce build dependency liblxqt0-dev (>= 0.11.0)
* Added build dependency libqt5svg5-dev
* Added Recommends libfm-qt-l10n
* Exported LC_ALL=C.UTF-8 - define language settings for reproducible
builds
* Hard override translation control
* Use DCMAKE_BUILD_TYPE=RelWithDebInfo
* Fixed copyright Format field, using https
* Fixed copyrights, removed obsolete files
* Fixed libfm-qt3.install, don't install translations
-- Alf Gaida <agaida@siduction.org> Tue, 18 Oct 2016 01:07:52 +0200
libfm-qt (0.11.0-2) unstable; urgency=medium
* Merged changes into unstable

2
debian/compat vendored

@ -1 +1 @@
9
10

12
debian/control vendored

@ -6,21 +6,24 @@ Uploaders: Alf Gaida <agaida@siduction.org>,
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
Section: x11
Priority: optional
Build-Depends: debhelper (>= 9),
Build-Depends: debhelper (>= 10),
cmake (>= 3.0.2),
libfm-dev (>= 1.2.0),
libglib2.0-dev,
libkf5windowsystem-dev,
liblxqt0-dev ( >= 0.11.0),
libmenu-cache-dev,
libqt5svg5-dev,
libqt5x11extras5-dev,
libqt5xdg-dev (>= 1.3.0),
libqt5xdg-dev (>= 2.0.0),
libx11-dev,
pkg-config,
qtbase5-private-dev,
qttools5-dev,
qttools5-dev-tools
Standards-Version: 3.9.7
Standards-Version: 3.9.8
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-lxqt/libfm-qt.git/?h=debian/sid
Vcs-Git: https://anonscm.debian.org/cgit/pkg-lxqt/libfm-qt.git -b debian/sid
Vcs-Git: https://anonscm.debian.org/git/pkg-lxqt/libfm-qt.git -b debian/sid
Homepage: https://github.com/lxde/libfm-qt
Package: libfm-qt3
@ -35,6 +38,7 @@ Multi-Arch: same
Section: libs
Depends: ${misc:Depends},
${shlibs:Depends}
Recommends: libfm-qt-l10n
Pre-Depends: ${misc:Pre-Depends}
Description: file management support for pcmanfm-qt
Libfm-Qt is a companion library providing components to build desktop file

10
debian/copyright vendored

@ -1,4 +1,4 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: libfm-qt
Source: https://github.com/lxde/libfm-qt
@ -13,14 +13,6 @@ Files: cmake/fm-qt-config.cmake.in
Copyright: 2015 Luís Pereira <luis.artur.pereira@gmail.com>
License: BSD-3-Clause
Files: cmake/Qt5PatchedLinguistToolsMacros.cmake
Copyright: 2005-2011 Kitware, Inc.
License: BSD-3-Clause
Files: src/xdndworkaround.*
Copyright: 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
License: LGPL-2.1+
Files: debian/*
Copyright: 2014-2015 Wen Liao <wen.cf83@gmail.com>
2014-2016 ChangZhuo Chen (陳昌倬) <czchen@debian.org>

@ -1,2 +1 @@
usr/lib/*/*.so.*
usr/share/libfm-qt/translations/*

13
debian/rules vendored

@ -1,9 +1,16 @@
#!/usr/bin/make -f
#DH_VERBOSE = 1
# export DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export LC_ALL=C.UTF-8
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh ${@} --buildsystem cmake \
--parallel
--fail-missing
override_dh_auto_configure:
dh_auto_configure -- \
-DPULL_TRANSLATIONS=OFF \
-DUPDATE_TRANSLATIONS=OFF \
-DCMAKE_BUILD_TYPE=RelWithDebInfo

@ -1,63 +1,50 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (GNU/Linux)
mQINBFJevCYBEACx+Hvy+Vsuf+V5jeLUnzjAmHoy8DfTeGWr3ts30IapLHrfi0+U
WpzNnISO77yTr4VNboVZH+GHM/rnPfieODfB4ZW6CZLlInMSKUXcgQsEqXpyBZhA
Ib/SPy2bOfHly1uRJes0uRDsH5+v/hD74sByfnjQlrvI68O6wvGZmDFMNNPVO8+/
OWBSBNkBuVrrZOMSPsLwQGJ4UtUQ4whburaPJG4VZJc5DLbzJGbEuACc0IAEYJS3
7AfXVXn4j4Gc9F3o1xTUnbOBnwGPquWwUIm3FM7Ec2OdkvMt3EwvnkMAfeVrq3iE
FDD/KZTxdL0BZH3QD8gB7Jm4v4f3Nkobg6JCvCbcH3wBdZW4mASbwWzfRaDC2zHb
ErTglD7PpShLKZZ0pr9okWZEGw4Ku3q8ALi1JXK/ePTmsBlvkVskOJ3Nnd0avgH4
+Q/vZoKfH8EhNY745rI+8CE9iv6V9XiSUt4CKEWAENt4A8hq6U2vV+jZv3B6AgD7
ZjiI59yD4YuYubu8rCnNizTgh1voVw3ietknn/x2H5yH8fByWZ5uL87C0ky/uma6
ZGbiiAtM4kdkyDMrfRV5nlEG9EKAGPVu5mjeSCrfkETwZ9OFPz1AuDye4ZEXrrcC
iRQ7RX6/GtW18aHER0kzGnfwx5KJzkDrRBY8A2PdXLBcrsN4WpK9EX01PQARAQAB
tCNKZXJvbWUgTGVjbGFuY2hlIDxqZXJvbWVAbGVjbGFuLmNoPokCPwQTAQIAKQUC
Ul68JgIbAwUJAeEzgAcLCQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAAAoJEDfgrx/a
SPNzSHIP/1ewXcC0TFBcvDD7MrIP7anyNfiWfW7cxkR8GSamkg6HTa6Ndyr1FFjJ
OoDFUP37jWhu59CsHxs2D0zRWJktezfvElscRgqbHcdpIznqsGdI8hXCZafhBGVb
sdAB2LRawcXGxnXt7XajPcSVwLWRE62caBqohznU2iWvI780WNjEbZoA0LhZwaFF
UUPJm8ea9v0IkZVKUyg9WONZ1U7FEG9SaEiSpI8kJdx1fvCwZVDV/NRO5GqnJaho
P1LCne4YdwS6pt1/fRgk32IHxxZfHlLzLHxb6v1JmIg72x28qCmGyK9oFBDbbnYu
6Aq8XbHogOrD5vJM2Pfm2IhV0+JHOjfQbddv8tsAH1M+LI+tToXmg5st1AU3wnTn
pda3hjA1avKwkfBPW/osHc8782ViyS9iX2e9iDtMv608guij4NjpGExzGCypHOd8
+VXRwJDjvgDynkL206MZ+wn0j5wHsIE8F3Y5Bp1thQOrdDli5MYNQoXhjFmH46XT
bcr84IgW0+AiXZdoFUqvwtzrWy2Onuw5R3k4OyV4skN4DkWXyAk/V+Y4K39JvTKf
H9YuiQ9blNzCu8WiAnjKnh9kNl9E/TyEwI6cHFmIPqF8ST9tJytWHtrKvU9csvXX
n8XNJmpcv2R1e6N+VuWWm5zUPTouv3AxCacLbm8Lh3ymGsk7ZEyhiQIcBBABAgAG
BQJSsFYyAAoJEBMY76xfu9vO6v0P/3wSj3/kE4nP4HfgcVJSzi+lm1ycpbLDZtgh
P1G+zJLVmA+E41vEZimeiYQxBAelatJz+CHzQo3LZ2oVChzVrZcVHn9k4P3pib69
qCVif3/y0Wmecn+u2TWbOvJ7mthfO7T3W7rkW1/9ES7bUaXcXWQ2sjUBVqFkFsVt
xgJDo8wcxA+K4Yf06GCbxFwrB7X5GraWIkzqGnyse3XAQn8aORAXmE8Yd0FHOjEZ
Beb9shChnkYc3lEvNY8ioCaYSF9xr/Iz9cwpfPkpqFiVYWadtb+Gqeh6zC7vPmcT
zHxrgkq1WwQlSBm724tPt9xuGQoOglqEa23vlQZfv20nyrYjLeYUy6pMCRq7vn/n
nkQOcXF7yQlnqR6xKk0tWsM4e6du0ZvbjBbhHV/kBFVGCLm/upTwoMVm0WJTbr4T
5XfIZo7eA0lvGtUhe1PgcOidBikHfAIfYxu0BoMXoL4jbcQdR5+YBDEfsS0jPhCl
mew2ScW/R/UhUknJUVFTma0KHXzEmKiqeeUCDtwEi6fxdicAYkbcekgkfFiD/w8N
Lk3Uf+0x2MdKA36nUobFkk38oU+GW37kFWJs3f1YRuQFao896eNW/E8ekVMLNxOl
nCjnSbabaxDnxPTyW2KlNjf/QUEK4pT6S5QmuCSrle3PQpaSbAZDHzLBIL9gd3m6
MH7+SvV4uQINBFJevCYBEADiXDUqstSdhIyuionS2KtE3IeEBIqS7GY8QPRBylIZ
ACVHFI/1HxChBqYVGFaDEQn3gj5lUUQPubfWaxzjF6+UNVQW4+cxmTocndAwfDbI
+E5BLdieFUzbAA05MV5ZjPhTNbSk1jpy4bNy0FILwNqc89Y6SoCbv1r3tZLCrBas
1+AfWknBynx0siGMbLFxtzR6hUkNz9URxt13FrzpUWMpAL8ZQGczOTSaWLrZA5l9
xLzJ9ww8uM+C2Xej3/sANxi+kQE2GVMKurPS0TICwVWZxbdW/ytIkO67Rhse0q3t
vzjdawfCFRxv7XQB2ZJ6irDxbpHiJoojSWCHJadIyCG03iOiaqsSVvi4KnxtUck+
udOEJUV5sxdzgeRrsDpeaN//KCWW9WjfsSkvOqP6S1gmWpNFdzF5XrzcgvqvSNqo
XejfakUTJqsIIEHO0zGuJFVzJNh2hQ/9dhjIspUORhtNKaljNvePiBrj2yqmd9PY
FlH1KMHe4H+YVIwPiyeNA87Pu+1yNo8gT7mXhGRfibgWjbt146WUJ7+l2StJMApn
eNSCartNaUNPnw96i2l5c9AsJ3SWC6XWpWzOLVj+9XceeA11lu/ogqEMHzx81NjH
2TePxwKTKxZnAvDmqryp++IgY2/OgIoIk3ZRdYu/dPijTOYWfCet/9/9kAFr9PeJ
KwARAQABiQIlBBgBAgAPBQJSXrwmAhsMBQkB4TOAAAoJEDfgrx/aSPNzJv0QAKkx
lCKEZ6ahAUuNWslsHnNWaHFHNawEO3NIEtQZGVFk2BYISupizvjZF6MnymO/9UFM
pzV6fp3xNdqaKWQBjScOgMgCASRixW2tMAKbJGHZKp3dBixpHgXxy2oOGMS+mQ5m
gWy07usq2YesoMD0K/SG6EnoRPHBvrJihArzMFVUY9hD3hk8bhiy8w9bCYFe+gkm
zpQl3/KN01kyt5LjzEBcIOw8qIBQe9Pk8PyOK75lPoNME714LatgOsyw2kaSQ9Sv
hziRGC5z/fV3PmH7XhSjENPKnCJU51GUMMLaL28t9o7Afh6Q8UV31/JO36vmQXQV
+b+0BoGqEmf3AKBASb2Cr2q4pZFjywwSUXHZ9hQyu1tpbE1dS6aI01kM0y270pk7
W/ajuzuOxAVL1bJAanL/5+DWM03esZPVdEWhxpWEM40Z6Rhq+Xb2a5xfwCN9PmaQ
o9fez0I+yh53s7Ypv0tBj05FPe5L48+pDi6pz5nddN1B0FzF58jVfsBZUjBlY24+
VwQeAaWkRXZrSEdtBS5ufsi80x/cNCSTJBWqtborKL1iGgf5MDPYRMSvmZXAeIld
pyL/0pbW7iokewyKzpFfo7KEbwLxB+flWaBZ867JpF4yyRj3b4qcvcyV8QnsoB7Z
KhxTl3gGwD/t0HUcu85zcfs4GkealYhIWfGaAso2
=fF8P
mQINBFXQeMMBEACif4+9pTrC6uNmRng0ZbzLh7p3cazmbnp2YFgDQDJZ7ZNmebxy
ngRuRhjGuDcFAL/37BwJnrBpfZFK9ljoH4Fo5Jm9cOELaTy7AIcEiV9dKMyrKF1E
C76d8jHVuzuPbI92DkFdLZAdk+qjrrAy0x43PvUd+aaBGLcFs1ZMk7gOvElc2d95
zWWSp5anjukmGbp+EsStnWJkF6VHj56qmklfYy5ioiVBOSpXo/RsACAcIlz8C8A1
d4tNMiB2uF2OrUfrL8DD6m3nBqep+AYbIQrxMl9kUQH3I33e9kH/L+SHQyE6phS8
Czq06WjV4TcJ9VWxm7hQCNLYSxhZYYr1AW45lS5+xmfBOq2qeLgvjbFxa8PPrsp6
Bqgt8MjwUkXjU5IB7YulUBvFU2l0MJZWDBuNy0oNtCe1cU3JyIqLKjvzQQQ9eD5L
o3Ul704TLHz0z+67Rxh05Mi4JvyFMjnooSJkNH8/7yXoBN0ZGOh1/5zMU1gK5bmP
6hKgis2exSZNIS74mF6/PqGgcwk3PyI4T3keUQoNPj11M2EznLHxY19QZfQ5oMed
8xOlHKjpcm8PYMB4gduNXlV7gI9h7UxuC5GuPiP2lmM6wUyHu48divxDk5UYgPEC
xlPI2wHCNDsuy0EruCYIvrMSZfpYCCSrmXiOORBLO5qXkauILLkJarHqjQARAQAB
tCBBbGYgR2FpZGEgPGFnYWlkYUBzaWR1Y3Rpb24ub3JnPokCOAQTAQIAIgUCVdB4
wwIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQQsnI069epeOT2xAAgSHf
41103cnElGf6TokPl4J6hdRPy2CUAjmBtMfr8eajYvGDGgnmsh9AGYGURjfFVCCf
Ag+8b6nF3xg03UmgsuSO8H78HGv9kKzF9aHmLt+SXq3jUX+LnIkFHErZWjFAKdJr
luu1j6ltxLe9PQljxZnugzMaUbW8eEPKvcriiDn3S4/DtikW/jpGA0MTY4ZWs9pZ
L/6iRRH99L2X/cWO4sCgDXCTt4oK0f5OvwiuCoVOM+PYoIm31JICCKOlqamkCn7d
2KH3nsy0v7tXgnrnb/zr8jVGsZLzUE51AFOzb5Ec74/2SAq8X4gbTppttLXEIooq
nbepitW/PePkPY5gpfwHtFbl88qFnir+ABMefqRZkzeh0tsxJVLVHGP1KZykXpv7
96A6Q1h7Zo9Ny7WwN5Xl02g35LVCaPyzd3A8A4315uMuP3iziq57UktKqh9d5S3t
jfK7e9UfFQZBLfxn2sNPsjdYSNUQp/PXTTk/599h359WVuUIR866T8K7N7EEon3p
qLItZljQ9Nmr/yGwKi9iQgi2LtZj5KUcF1zBLzZKf95FvoqSZqBXdFSjm+eYGaCH
Q2IBnhyP92lEknSK9ystUJXmY69tQKBFqJxScwaS+7a/rfLKssQjSWxqk+SX4QeW
e9z9FUpo71bq0Zkc/M9aOCoEEmhg4Ob/JWy08oC5Ag0EVdB4wwEQAKZDCc/C41y0
omLFCAJybvHiFScM+jOpyGpQvceoviEhIT7h1br/pnSEMkgPQEDPWJGtKueg1/94
sXTH24uefr3Y6JdZoBtprxl4JXUoOndgq1QH1xuUsy3/9YWU8Qboy9j8a8w0oCDE
T8Z03KHCwqzD3K+44jhmhF+0eLoaaY8ohS8ziP+DcFKVHyatmS5yCCdjVrj6PxMp
uy/y5SXT1kmiPdVAIzQlM5DlN6o46TV+BH0pPvVYjtwf31o0FckJxy5S1v0koCNB
vX2b7tTDPKzn8G18eUVhGoUTZBUCp1gg36wJ0YY4xgZ9vI/xDCeHeAkyvGtaTAoy
qP4rHoUO5KVRSDh7frSlrdbLGWHaQwOhcqoKd4qP/164wHPGkgHL1vztdOc7l1wx
q3gMh2uwmJR0NRrw4WVuaIqL9lEbGBNijlmGsuqXfsMRhc/qoqgVDWvrcCtEoOwl
TONGobW3jpCCjpa9SeGNjxuY6IVLn0lfX4hItNVY9sFA+H+yj4uBQ7zsmMUXafxt
Yllm0f98yGNg5lnJg4bLOYu3IkpogUKNA3qkZ+6vRtwH70/bJGp7qdx/3G4W5dMX
asd/rJjdELW+R/NVULAmK1ETSklaa3Z6vbTu8bN8gvP8pmMJ8f/U8+qzkuAqc201
Z4O+s7ZsQfTiz5mm7zPGIYTnppDSno/rABEBAAGJAh8EGAECAAkFAlXQeMMCGwwA
CgkQQsnI069epeMt0g/+JrwLhULD6NOxaLgxboh/KZkh/7ViU4cB+QPT8JIcWxkZ
zj8uk85TUitEUzKmjp/ItCrhQE5WNNWbz/FBnAuLtaQuHhcHMA3Vu95UUCGi1vyZ
ZRlS3YRM6S9BOzrjG7fGQJmO/RU3g6rb0TAwGFxDHj8t4JEDTc3zASG7wV/VTn06
d8XIH9CZOw3kUuhkQ3OR/PEj1BCeCC+caC+tBjO0fgvDp8RV7NFQQ9kH8R3/xlWd
6KMPtILE6fUft6LubWRGd1P5JBuzXivELolASajewbYtL/s87CCji3ngq0aT9raK
m02wqFzNbX1iv+w2iqPQXq6pdRyxtJ8+Q8Z7zEBGJS5nkrYjsLTduZIjJHYHYH7f
3/ydVjQ3z12iqHKElgaRI7RUmpNiNxVIr+TtuxzeC6G+CF++XNkUtJODvCmRaoJS
waYsitz8+LSv3tawZJ0iQkKc9nerQMuBD+AzIr3i4NgXiEIN513esUtnKzeyIIsL
ntUcBjXKuLCj8OZrZtexjq7edWWbN57/3ikyS2Z7y0i3O30qk5jmccSaS6kA7xTY
WCDFzbN2v2y+vGu9KYn+2HtrP2BtNa8JTh3waNeLUTpn4GV4mMrsZjOy6vhhHb91
1TKfI1gvjk7lE9xaWmcDjdI55dw3jIq8kK9SdgORGq9/S3g7KJNRjme+6GjqQfk=
=h7ww
-----END PGP PUBLIC KEY BLOCK-----

4
debian/watch vendored

@ -1,3 +1,3 @@
version=3
version=4
opts="pgpsigurlmangle=s/$/.asc/" \
https://github.com/lxde/libfm-qt/releases .*/([\d\.]+).tar.gz
https://github.com/lxde/libfm-qt/releases .*/libfm-qt-([\d\.]+).tar.xz

@ -1,10 +1,9 @@
set(libfm_TRANSLATION_TEMPLATE ${PROJECT_NAME})
include_directories(
"${LIBFM_INCLUDE_DIRS}"
"${LIBFM_INCLUDEDIR}/libfm" # to workaround incorrect #include in fm-actions.
"${LIBMENUCACHE_INCLUDE_DIRS}"
"${SYSTEM_LIBS_INCLUDE_DIRS}"
"${XCB_INCLUDE_DIRS}"
)
link_directories(
@ -51,7 +50,6 @@ set(libfm_SRCS
dndactionmenu.cpp
editbookmarksdialog.cpp
thumbnailloader.cpp
path.cpp
execfiledialog.cpp
appchoosercombobox.cpp
appmenuview.cpp
@ -78,7 +76,11 @@ qt5_wrap_ui(libfm_UIS_H ${libfm_UIS})
lxqt_translate_ts(QM_FILES
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
SOURCES ${libfm_SRCS} ${libfm_UIS}
TEMPLATE ${libfm_TRANSLATION_TEMPLATE}
INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/libfm-qt/translations"
PULL_TRANSLATIONS ${PULL_TRANSLATIONS}
CLEAN_TRANSLATIONS ${CLEAN_TRANSLATIONS}
TRANSLATIONS_REPO ${TRANSLATIONS_REPO}
TRANSLATIONS_REFSPEC ${TRANSLATIONS_REFSPEC}
)
add_library(${LIBFM_QT_LIBRARY_NAME} SHARED
@ -110,6 +112,7 @@ target_link_libraries(${LIBFM_QT_LIBRARY_NAME}
${LIBFM_LIBRARIES}
${LIBMENUCACHE_LIBRARIES}
${SYSTEM_LIBS_LIBRARIES}
${XCB_LIBRARIES}
)
# set libtool soname
@ -130,11 +133,11 @@ install(FILES
COMPONENT Devel
)
file(GLOB libfm_HS "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
# install include header files (FIXME: can we make this cleaner? should dir name be versioned?)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
install(FILES ${libfm_HS}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libfm-qt"
COMPONENT Devel
FILES_MATCHING PATTERN "*.h"
)
generate_export_header(${LIBFM_QT_LIBRARY_NAME}
@ -188,11 +191,5 @@ else()
)
endif()
install(FILES
${QM_FILES}
DESTINATION "${CMAKE_INSTALL_DATADIR}/libfm-qt/translations"
COMPONENT Runtime
)
# prevent the generated files from being deleted during make cleaner
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true)

@ -26,11 +26,11 @@ namespace Fm {
AppChooserComboBox::AppChooserComboBox(QWidget* parent):
QComboBox(parent),
defaultApp_(NULL),
mimeType_(NULL),
appInfos_(NULL),
defaultApp_(NULL),
defaultAppIndex_(-1),
prevIndex_(0),
mimeType_(NULL),
blockOnCurrentIndexChanged_(false) {
// the new Qt5 signal/slot syntax cannot handle overloaded methods by default

@ -27,10 +27,10 @@ namespace Fm {
AppChooserDialog::AppChooserDialog(FmMimeType* mimeType, QWidget* parent, Qt::WindowFlags f):
QDialog(parent, f),
ui(new Ui::AppChooserDialog()),
mimeType_(NULL),
selectedApp_(NULL),
canSetDefault_(true),
ui(new Ui::AppChooserDialog()) {
selectedApp_(NULL) {
ui->setupUi(this);
connect(ui->appMenuView, &AppMenuView::selectionChanged, this, &AppChooserDialog::onSelectionChanged);

@ -26,10 +26,10 @@
namespace Fm {
AppMenuView::AppMenuView(QWidget* parent):
QTreeView(parent),
model_(new QStandardItemModel()),
menu_cache(NULL),
menu_cache_reload_notify(NULL),
QTreeView(parent) {
menu_cache_reload_notify(NULL) {
setHeaderHidden(true);
setSelectionMode(SingleSelection);

@ -0,0 +1,143 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_ARCHIVER_H__
#define __LIBFM_QT_FM_ARCHIVER_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API Archiver {
public:
// default constructor
Archiver() {
dataPtr_ = nullptr;
}
// move constructor
Archiver(Archiver&& other) {
dataPtr_ = reinterpret_cast<FmArchiver*>(other.takeDataPtr());
}
// destructor
~Archiver() {
if(dataPtr_ != nullptr) {
(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static Archiver wrapPtr(FmArchiver* dataPtr) {
Archiver obj;
obj.dataPtr_ = reinterpret_cast<FmArchiver*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmArchiver* takeDataPtr() {
FmArchiver* data = reinterpret_cast<FmArchiver*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmArchiver* dataPtr() {
return reinterpret_cast<FmArchiver*>(dataPtr_);
}
// automatic type casting
operator FmArchiver*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// move assignment
Archiver& operator=(Archiver&& other) {
dataPtr_ = reinterpret_cast<FmArchiver*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
void setDefault(void) {
fm_archiver_set_default(dataPtr());
}
static Archiver getDefault( ) {
return wrapPtr(fm_archiver_get_default());
}
bool extractArchivesTo(GAppLaunchContext* ctx, FmPathList* files, FmPath* dest_dir) {
return fm_archiver_extract_archives_to(dataPtr(), ctx, files, dest_dir);
}
bool extractArchives(GAppLaunchContext* ctx, FmPathList* files) {
return fm_archiver_extract_archives(dataPtr(), ctx, files);
}
bool createArchive(GAppLaunchContext* ctx, FmPathList* files) {
return fm_archiver_create_archive(dataPtr(), ctx, files);
}
bool isMimeTypeSupported(const char* type) {
return fm_archiver_is_mime_type_supported(dataPtr(), type);
}
// the wrapped object cannot be copied.
private:
Archiver(const Archiver& other) = delete;
Archiver& operator=(const Archiver& other) = delete;
private:
FmArchiver* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_ARCHIVER_H__

@ -0,0 +1,163 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_BOOKMARKS_H__
#define __LIBFM_QT_FM_BOOKMARKS_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API Bookmarks {
public:
// default constructor
Bookmarks() {
dataPtr_ = nullptr;
}
Bookmarks(FmBookmarks* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
Bookmarks(const Bookmarks& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
Bookmarks(Bookmarks&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// destructor
virtual ~Bookmarks() {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static Bookmarks wrapPtr(FmBookmarks* dataPtr) {
Bookmarks obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmBookmarks* takeDataPtr() {
FmBookmarks* data = reinterpret_cast<FmBookmarks*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmBookmarks* dataPtr() {
return reinterpret_cast<FmBookmarks*>(dataPtr_);
}
// automatic type casting
operator FmBookmarks*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
Bookmarks& operator=(const Bookmarks& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
Bookmarks& operator=(Bookmarks&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
GList* getAll(void) {
return fm_bookmarks_get_all(dataPtr());
}
void rename(FmBookmarkItem* item, const char* new_name) {
fm_bookmarks_rename(dataPtr(), item, new_name);
}
void reorder(FmBookmarkItem* item, int pos) {
fm_bookmarks_reorder(dataPtr(), item, pos);
}
void remove(FmBookmarkItem* item) {
fm_bookmarks_remove(dataPtr(), item);
}
FmBookmarkItem* insert(FmPath* path, const char* name, int pos) {
return fm_bookmarks_insert(dataPtr(), path, name, pos);
}
static Bookmarks dup(void ) {
return Bookmarks::wrapPtr(fm_bookmarks_dup());
}
// automatic type casting for GObject
operator GObject*() {
return reinterpret_cast<GObject*>(dataPtr_);
}
protected:
GObject* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_BOOKMARKS_H__

@ -0,0 +1,152 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_CONFIG_H__
#define __LIBFM_QT_FM_CONFIG_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API Config {
public:
Config(void ) {
dataPtr_ = reinterpret_cast<GObject*>(fm_config_new());
}
Config(FmConfig* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
Config(const Config& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
Config(Config&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// destructor
virtual ~Config() {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static Config wrapPtr(FmConfig* dataPtr) {
Config obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmConfig* takeDataPtr() {
FmConfig* data = reinterpret_cast<FmConfig*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmConfig* dataPtr() {
return reinterpret_cast<FmConfig*>(dataPtr_);
}
// automatic type casting
operator FmConfig*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
Config& operator=(const Config& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
Config& operator=(Config&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
void emitChanged(const char* changed_key) {
fm_config_emit_changed(dataPtr(), changed_key);
}
void save(const char* name) {
fm_config_save(dataPtr(), name);
}
void loadFromKeyFile(GKeyFile* kf) {
fm_config_load_from_key_file(dataPtr(), kf);
}
void loadFromFile(const char* name) {
fm_config_load_from_file(dataPtr(), name);
}
// automatic type casting for GObject
operator GObject*() {
return reinterpret_cast<GObject*>(dataPtr_);
}
protected:
GObject* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_CONFIG_H__

@ -0,0 +1,128 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_DEEP_COUNT_JOB_H__
#define __LIBFM_QT_FM_DEEP_COUNT_JOB_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
#include "job.h"
namespace Fm {
class LIBFM_QT_API DeepCountJob: public Job {
public:
DeepCountJob(FmPathList* paths, FmDeepCountJobFlags flags) {
dataPtr_ = reinterpret_cast<GObject*>(fm_deep_count_job_new(paths, flags));
}
// default constructor
DeepCountJob() {
dataPtr_ = nullptr;
}
DeepCountJob(FmDeepCountJob* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
DeepCountJob(const DeepCountJob& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
DeepCountJob(DeepCountJob&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// create a wrapper for the data pointer without increasing the reference count
static DeepCountJob wrapPtr(FmDeepCountJob* dataPtr) {
DeepCountJob obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmDeepCountJob* takeDataPtr() {
FmDeepCountJob* data = reinterpret_cast<FmDeepCountJob*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmDeepCountJob* dataPtr() {
return reinterpret_cast<FmDeepCountJob*>(dataPtr_);
}
// automatic type casting
operator FmDeepCountJob*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
DeepCountJob& operator=(const DeepCountJob& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
DeepCountJob& operator=(DeepCountJob&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
void setDest(dev_t dev, const char* fs_id) {
fm_deep_count_job_set_dest(dataPtr(), dev, fs_id);
}
};
}
#endif // __LIBFM_QT_FM_DEEP_COUNT_JOB_H__

@ -0,0 +1,148 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_DIR_LIST_JOB_H__
#define __LIBFM_QT_FM_DIR_LIST_JOB_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
#include "job.h"
namespace Fm {
class LIBFM_QT_API DirListJob: public Job {
public:
DirListJob(FmPath* path, gboolean dir_only) {
dataPtr_ = reinterpret_cast<GObject*>(fm_dir_list_job_new(path, dir_only));
}
// default constructor
DirListJob() {
dataPtr_ = nullptr;
}
DirListJob(FmDirListJob* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
DirListJob(const DirListJob& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
DirListJob(DirListJob&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// create a wrapper for the data pointer without increasing the reference count
static DirListJob wrapPtr(FmDirListJob* dataPtr) {
DirListJob obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmDirListJob* takeDataPtr() {
FmDirListJob* data = reinterpret_cast<FmDirListJob*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmDirListJob* dataPtr() {
return reinterpret_cast<FmDirListJob*>(dataPtr_);
}
// automatic type casting
operator FmDirListJob*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
DirListJob& operator=(const DirListJob& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
DirListJob& operator=(DirListJob&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
void addFoundFile(FmFileInfo* file) {
fm_dir_list_job_add_found_file(dataPtr(), file);
}
void setIncremental(gboolean set) {
fm_dir_list_job_set_incremental(dataPtr(), set);
}
FmFileInfoList* getFiles(void) {
return fm_dir_list_job_get_files(dataPtr());
}
static DirListJob newForGfile(GFile* gf) {
return DirListJob::wrapPtr(fm_dir_list_job_new_for_gfile(gf));
}
static DirListJob new2(FmPath* path, FmDirListJobFlags flags) {
return DirListJob::wrapPtr(fm_dir_list_job_new2(path, flags));
}
};
}
#endif // __LIBFM_QT_FM_DIR_LIST_JOB_H__

@ -25,25 +25,25 @@
namespace Fm {
DirTreeModelItem::DirTreeModelItem():
model_(nullptr),
fileInfo_(nullptr),
folder_(nullptr),
expanded_(false),
loaded_(false),
fileInfo_(nullptr),
parent_(nullptr),
placeHolderChild_(nullptr),
parent_(nullptr) {
model_(nullptr) {
}
DirTreeModelItem::DirTreeModelItem(FmFileInfo* info, DirTreeModel* model, DirTreeModelItem* parent):
model_(model),
folder_(nullptr),
expanded_(false),
loaded_(false),
fileInfo_(fm_file_info_ref(info)),
folder_(nullptr),
displayName_(QString::fromUtf8(fm_file_info_get_disp_name(info))),
icon_(IconTheme::icon(fm_file_info_get_icon(info))),
expanded_(false),
loaded_(false),
parent_(parent),
placeHolderChild_(nullptr),
parent_(parent) {
model_(model) {
if(info)
addPlaceHolderChild();

@ -30,8 +30,8 @@
namespace Fm {
DirTreeView::DirTreeView(QWidget* parent):
currentExpandingItem_(NULL),
currentPath_(NULL) {
currentPath_(NULL),
currentExpandingItem_(NULL) {
setSelectionMode(QAbstractItemView::SingleSelection);
setHeaderHidden(true);
@ -66,7 +66,7 @@ void DirTreeView::expandPendingPath() {
if(pathsToExpand_.isEmpty())
return;
FmPath* path = pathsToExpand_.first().data();
FmPath* path = pathsToExpand_.first();
// qDebug() << "expanding: " << Path(path).displayBasename();
DirTreeModel* _model = static_cast<DirTreeModel*>(model());
DirTreeModelItem* item = _model->itemFromPath(path);

@ -44,13 +44,13 @@ bool DndDest::dropMimeData(const QMimeData* data, Qt::DropAction action) {
FmPathList* srcPaths = pathListFromQUrls(data->urls());
switch(action) {
case Qt::CopyAction:
FileOperation::copyFiles(srcPaths, destPath_.data());
FileOperation::copyFiles(srcPaths, destPath_);
break;
case Qt::MoveAction:
FileOperation::moveFiles(srcPaths, destPath_.data());
FileOperation::moveFiles(srcPaths, destPath_);
break;
case Qt::LinkAction:
FileOperation::symlinkFiles(srcPaths, destPath_.data());
FileOperation::symlinkFiles(srcPaths, destPath_);
default:
fm_path_list_unref(srcPaths);
return false;

@ -0,0 +1,35 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_DUMMY_MONITOR_H__
#define __LIBFM_QT_FM_DUMMY_MONITOR_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
}
#endif // __LIBFM_QT_FM_DUMMY_MONITOR_H__

@ -25,9 +25,9 @@ namespace Fm {
ExecFileDialog::ExecFileDialog(FmFileInfo* file, QWidget* parent, Qt::WindowFlags f):
QDialog (parent, f),
ui(new Ui::ExecFileDialog()),
fileInfo_(fm_file_info_ref(file)),
result_(FM_FILE_LAUNCHER_EXEC_CANCEL),
ui(new Ui::ExecFileDialog()) {
result_(FM_FILE_LAUNCHER_EXEC_CANCEL) {
ui->setupUi(this);
// show file icon

@ -126,7 +126,7 @@
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Mime type:</string>
<string>MIME type:</string>
</property>
</widget>
</item>

@ -0,0 +1,153 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_FILE_H__
#define __LIBFM_QT_FM_FILE_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API File {
public:
// default constructor
File() {
dataPtr_ = nullptr;
}
File(FmFile* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
File(const File& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
File(File&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// destructor
virtual ~File() {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static File wrapPtr(FmFile* dataPtr) {
File obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmFile* takeDataPtr() {
FmFile* data = reinterpret_cast<FmFile*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmFile* dataPtr() {
return reinterpret_cast<FmFile*>(dataPtr_);
}
// automatic type casting
operator FmFile*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
File& operator=(const File& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
File& operator=(File&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
static GFile* newForCommandlineArg(const char* arg) {
return fm_file_new_for_commandline_arg(arg);
}
static GFile* newForUri(const char* uri) {
return fm_file_new_for_uri(uri);
}
static bool wantsIncremental(GFile* file) {
return fm_file_wants_incremental(file);
}
static void addVfs(const char* name, FmFileInitTable* init) {
fm_file_add_vfs(name, init);
}
// automatic type casting for GObject
operator GObject*() {
return reinterpret_cast<GObject*>(dataPtr_);
}
protected:
GObject* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_FILE_H__

@ -0,0 +1,511 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_FILE_INFO_H__
#define __LIBFM_QT_FM_FILE_INFO_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API FileInfoList {
public:
FileInfoList( ) {
dataPtr_ = reinterpret_cast<FmFileInfoList*>(fm_file_info_list_new());
}
FileInfoList(FmFileInfoList* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmFileInfoList*>(fm_list_ref(FM_LIST(dataPtr))) : nullptr;
}
// copy constructor
FileInfoList(const FileInfoList& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmFileInfoList*>(fm_list_ref(FM_LIST(other.dataPtr_))) : nullptr;
}
// move constructor
FileInfoList(FileInfoList&& other) {
dataPtr_ = reinterpret_cast<FmFileInfoList*>(other.takeDataPtr());
}
// destructor
~FileInfoList() {
if(dataPtr_ != nullptr) {
fm_list_unref(FM_LIST(dataPtr_));
}
}
// create a wrapper for the data pointer without increasing the reference count
static FileInfoList wrapPtr(FmFileInfoList* dataPtr) {
FileInfoList obj;
obj.dataPtr_ = reinterpret_cast<FmFileInfoList*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmFileInfoList* takeDataPtr() {
FmFileInfoList* data = reinterpret_cast<FmFileInfoList*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmFileInfoList* dataPtr() {
return reinterpret_cast<FmFileInfoList*>(dataPtr_);
}
// automatic type casting
operator FmFileInfoList*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
FileInfoList& operator=(const FileInfoList& other) {
if(dataPtr_ != nullptr) {
fm_list_unref(FM_LIST(dataPtr_));
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmFileInfoList*>(fm_list_ref(FM_LIST(other.dataPtr_))) : nullptr;
return *this;
}
// move assignment
FileInfoList& operator=(FileInfoList&& other) {
dataPtr_ = reinterpret_cast<FmFileInfoList*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
bool isSameFs(void) {
return fm_file_info_list_is_same_fs(dataPtr());
}
bool isSameType(void) {
return fm_file_info_list_is_same_type(dataPtr());
}
bool isEmpty() {
return fm_file_info_list_is_empty(dataPtr());
}
unsigned int getLength() {
return fm_file_info_list_get_length(dataPtr());
}
FmFileInfo* peekHead() {
return fm_file_info_list_peek_head(dataPtr());
}
GList* peekHeadLink() {
return fm_file_info_list_peek_head_link(dataPtr());
}
void pushTail(FmFileInfo* d) {
fm_file_info_list_push_tail(dataPtr(), d);
}
void pushTailLink(GList* d) {
fm_file_info_list_push_tail_link(dataPtr(), d);
}
FmFileInfo* popHead(){
return fm_file_info_list_pop_head(dataPtr());
}
void deleteLink(GList* _l) {
fm_file_info_list_delete_link(dataPtr(), _l);
}
void clear() {
fm_file_info_list_clear(dataPtr());
}
private:
FmFileInfoList* dataPtr_; // data pointer for the underlying C struct
};
class LIBFM_QT_API FileInfo {
public:
FileInfo( ) {
dataPtr_ = reinterpret_cast<FmFileInfo*>(fm_file_info_new());
}
FileInfo(FmFileInfo* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmFileInfo*>(fm_file_info_ref(dataPtr)) : nullptr;
}
// copy constructor
FileInfo(const FileInfo& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmFileInfo*>(fm_file_info_ref(other.dataPtr_)) : nullptr;
}
// move constructor
FileInfo(FileInfo&& other) {
dataPtr_ = reinterpret_cast<FmFileInfo*>(other.takeDataPtr());
}
// destructor
~FileInfo() {
if(dataPtr_ != nullptr) {
fm_file_info_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static FileInfo wrapPtr(FmFileInfo* dataPtr) {
FileInfo obj;
obj.dataPtr_ = reinterpret_cast<FmFileInfo*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmFileInfo* takeDataPtr() {
FmFileInfo* data = reinterpret_cast<FmFileInfo*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmFileInfo* dataPtr() {
return reinterpret_cast<FmFileInfo*>(dataPtr_);
}
// automatic type casting
operator FmFileInfo*() {
return dataPtr();
}
// copy assignment
FileInfo& operator=(const FileInfo& other) {
if(dataPtr_ != nullptr) {
fm_file_info_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmFileInfo*>(fm_file_info_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
FileInfo& operator=(FileInfo&& other) {
dataPtr_ = reinterpret_cast<FmFileInfo*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
bool canSetHidden(void) {
return fm_file_info_can_set_hidden(dataPtr());
}
bool canSetIcon(void) {
return fm_file_info_can_set_icon(dataPtr());
}
bool canSetName(void) {
return fm_file_info_can_set_name(dataPtr());
}
bool canThumbnail(void) {
return fm_file_info_can_thumbnail(dataPtr());
}
dev_t getDev(void) {
return fm_file_info_get_dev(dataPtr());
}
gid_t getGid(void) {
return fm_file_info_get_gid(dataPtr());
}
uid_t getUid(void) {
return fm_file_info_get_uid(dataPtr());
}
const char* getDispGroup() {
return fm_file_info_get_disp_group(dataPtr());
}
const char* getFsId() {
return fm_file_info_get_fs_id(dataPtr());
}
FmIcon* getIcon(void) {
return fm_file_info_get_icon(dataPtr());
}
time_t getCtime(void) {
return fm_file_info_get_ctime(dataPtr());
}
time_t getAtime(void) {
return fm_file_info_get_atime(dataPtr());
}
time_t getMtime(void) {
return fm_file_info_get_mtime(dataPtr());
}
const char* getTarget() {
return fm_file_info_get_target(dataPtr());
}
const char* getCollateKey() {
return fm_file_info_get_collate_key(dataPtr());
}
const char* getCollateKeyNoCaseFold() {
return fm_file_info_get_collate_key_nocasefold(dataPtr());
}
const char* getDesc() {
return fm_file_info_get_desc(dataPtr());
}
const char* getDispMtime() {
return fm_file_info_get_disp_mtime(dataPtr());
}
bool isWritableDirectory(void) {
return fm_file_info_is_writable_directory(dataPtr());
}
bool isAccessible(void) {
return fm_file_info_is_accessible(dataPtr());
}
bool isExecutableType(void) {
return fm_file_info_is_executable_type(dataPtr());
}
bool isBackup(void) {
return fm_file_info_is_backup(dataPtr());
}
bool isHidden(void) {
return fm_file_info_is_hidden(dataPtr());
}
bool isUnknownType(void) {
return fm_file_info_is_unknown_type(dataPtr());
}
bool isDesktopEntry(void) {
return fm_file_info_is_desktop_entry(dataPtr());
}
bool isText(void) {
return fm_file_info_is_text(dataPtr());
}
bool isImage(void) {
return fm_file_info_is_image(dataPtr());
}
bool isMountable(void) {
return fm_file_info_is_mountable(dataPtr());
}
bool isShortcut(void) {
return fm_file_info_is_shortcut(dataPtr());
}
bool isSymlink(void) {
return fm_file_info_is_symlink(dataPtr());
}
bool isDir(void) {
return fm_file_info_is_dir(dataPtr());
}
FmMimeType* getMimeType(void) {
return fm_file_info_get_mime_type(dataPtr());
}
bool isNative(void) {
return fm_file_info_is_native(dataPtr());
}
mode_t getMode(void) {
return fm_file_info_get_mode(dataPtr());
}
goffset getBlocks(void) {
return fm_file_info_get_blocks(dataPtr());
}
goffset getSize(void) {
return fm_file_info_get_size(dataPtr());
}
const char* getDispSize() {
return fm_file_info_get_disp_size(dataPtr());
}
void setIcon(GIcon* icon) {
fm_file_info_set_icon(dataPtr(), icon);
}
void setDispName(const char* name) {
fm_file_info_set_disp_name(dataPtr(), name);
}
void setPath(FmPath* path) {
fm_file_info_set_path(dataPtr(), path);
}
const char* getName() {
return fm_file_info_get_name(dataPtr());
}
const char* getDispName() {
return fm_file_info_get_disp_name(dataPtr());
}
FmPath* getPath(void) {
return fm_file_info_get_path(dataPtr());
}
void update(FmFileInfo* src) {
fm_file_info_update(dataPtr(), src);
}
static FileInfo newFromNativeFile(FmPath* path, const char* path_str, GError** err) {
return FileInfo::wrapPtr(fm_file_info_new_from_native_file(path, path_str, err));
}
bool setFromNativeFile(const char* path, GError** err) {
return fm_file_info_set_from_native_file(dataPtr(), path, err);
}
void setFromMenuCacheItem(struct _MenuCacheItem* item) {
fm_file_info_set_from_menu_cache_item(dataPtr(), item);
}
static FileInfo newFromMenuCacheItem(FmPath* path, struct _MenuCacheItem* item) {
return FileInfo::wrapPtr(fm_file_info_new_from_menu_cache_item(path, item));
}
void setFromGFileData(GFile* gf, GFileInfo* inf) {
fm_file_info_set_from_g_file_data(dataPtr(), gf, inf);
}
static FileInfo newFromGFileData(GFile* gf, GFileInfo* inf, FmPath* path) {
return FileInfo::wrapPtr(fm_file_info_new_from_g_file_data(gf, inf, path));
}
void setFromGfileinfo(GFileInfo* inf) {
fm_file_info_set_from_gfileinfo(dataPtr(), inf);
}
static FileInfo newFromGfileinfo(FmPath* path, GFileInfo* inf) {
return FileInfo::wrapPtr(fm_file_info_new_from_gfileinfo(path, inf));
}
private:
FmFileInfo* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_FILE_INFO_H__

@ -0,0 +1,138 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_FILE_INFO_JOB_H__
#define __LIBFM_QT_FM_FILE_INFO_JOB_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
#include "job.h"
namespace Fm {
class LIBFM_QT_API FileInfoJob: public Job {
public:
FileInfoJob(FmPathList* files_to_query, FmFileInfoJobFlags flags) {
dataPtr_ = reinterpret_cast<GObject*>(fm_file_info_job_new(files_to_query, flags));
}
// default constructor
FileInfoJob() {
dataPtr_ = nullptr;
}
FileInfoJob(FmFileInfoJob* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
FileInfoJob(const FileInfoJob& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
FileInfoJob(FileInfoJob&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// create a wrapper for the data pointer without increasing the reference count
static FileInfoJob wrapPtr(FmFileInfoJob* dataPtr) {
FileInfoJob obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmFileInfoJob* takeDataPtr() {
FmFileInfoJob* data = reinterpret_cast<FmFileInfoJob*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmFileInfoJob* dataPtr() {
return reinterpret_cast<FmFileInfoJob*>(dataPtr_);
}
// automatic type casting
operator FmFileInfoJob*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
FileInfoJob& operator=(const FileInfoJob& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
FileInfoJob& operator=(FileInfoJob&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
FmPath* getCurrent(void) {
return fm_file_info_job_get_current(dataPtr());
}
void addGfile(GFile* gf) {
fm_file_info_job_add_gfile(dataPtr(), gf);
}
void add(FmPath* path) {
fm_file_info_job_add(dataPtr(), path);
}
};
}
#endif // __LIBFM_QT_FM_FILE_INFO_JOB_H__

@ -44,8 +44,8 @@ FileMenu::FileMenu(FmFileInfoList* files, FmFileInfo* info, FmPath* cwd, QWidget
FileMenu::FileMenu(FmFileInfoList* files, FmFileInfo* info, FmPath* cwd, const QString& title, QWidget* parent):
QMenu(title, parent),
fileLauncher_(NULL),
unTrashAction_(NULL) {
unTrashAction_(NULL),
fileLauncher_(NULL) {
createMenu(files, info, cwd);
}
@ -99,7 +99,7 @@ void FileMenu::createMenu(FmFileInfoList* files, FmFileInfo* info, FmPath* cwd)
openWithMenuAction_ = new QAction(tr("Open With..."), this);
addAction(openWithMenuAction_);
// create the "Open with..." sub menu
QMenu* menu = new QMenu();
QMenu* menu = new QMenu(this);
openWithMenuAction_->setMenu(menu);
if(sameType_) { /* add specific menu items for this mime type */
@ -116,11 +116,13 @@ void FileMenu::createMenu(FmFileInfoList* files, FmFileInfo* info, FmPath* cwd)
g_free(program_path);
// create a QAction for the application.
AppInfoAction* action = new AppInfoAction(app);
AppInfoAction* action = new AppInfoAction(app, menu);
connect(action, &QAction::triggered, this, &FileMenu::onApplicationTriggered);
menu->addAction(action);
}
g_list_free(apps); /* don't unref GAppInfos now */
// unref GAppInfos here, they are still ref'ed in the AppInfoActions above
g_list_foreach(apps, (GFunc)g_object_unref, NULL);
g_list_free(apps);
}
}
menu->addSeparator();
@ -245,10 +247,12 @@ void FileMenu::addCustomActionItem(QMenu* menu, FmFileActionItem* item) {
menu->addAction(action);
if(fm_file_action_item_is_menu(item)) {
GList* subitems = fm_file_action_item_get_sub_items(item);
if (subitems != NULL) {
QMenu* submenu = new QMenu(menu);
for(GList* l = subitems; l; l = l->next) {
FmFileActionItem* subitem = FM_FILE_ACTION_ITEM(l->data);
QMenu* submenu = new QMenu(menu);
addCustomActionItem(submenu, subitem);
}
action->setMenu(submenu);
}
}
@ -350,6 +354,7 @@ void FileMenu::onDeleteTriggered() {
void FileMenu::onUnTrashTriggered() {
FmPathList* paths = fm_path_list_new_from_file_info_list(files_);
FileOperation::unTrashFiles(paths);
fm_path_list_unref(paths);
}
void FileMenu::onPasteTriggered() {

@ -31,6 +31,7 @@ namespace Fm {
FileOperation::FileOperation(Type type, FmPathList* srcFiles, QObject* parent):
QObject(parent),
job_(fm_file_ops_job_new((FmFileOpType)type, srcFiles)),
dlg(NULL),
destPath(NULL),
srcPaths(fm_path_list_ref(srcFiles)),
@ -38,8 +39,7 @@ FileOperation::FileOperation(Type type, FmPathList* srcFiles, QObject* parent):
elapsedTimer_(NULL),
lastElapsed_(0),
updateRemainingTime_(true),
autoDestroy_(true),
job_(fm_file_ops_job_new((FmFileOpType)type, srcFiles)) {
autoDestroy_(true) {
g_signal_connect(job_, "ask", G_CALLBACK(onFileOpsJobAsk), this);
g_signal_connect(job_, "ask-rename", G_CALLBACK(onFileOpsJobAskRename), this);

@ -51,7 +51,7 @@ FileOperationDialog::FileOperationDialog(FileOperation* _operation):
break;
case FM_FILE_OP_DELETE:
title = tr("Delete Files");
message = tr("Deleting the following files");
message = tr("Deleting the following files:");
ui->dest->hide();
ui->destLabel->hide();
break;

@ -0,0 +1,193 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_FILE_OPS_JOB_H__
#define __LIBFM_QT_FM_FILE_OPS_JOB_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
#include "job.h"
namespace Fm {
class LIBFM_QT_API FileOpsJob: public Job {
public:
FileOpsJob(FmFileOpType type, FmPathList* files) {
dataPtr_ = reinterpret_cast<GObject*>(fm_file_ops_job_new(type, files));
}
// default constructor
FileOpsJob() {
dataPtr_ = nullptr;
}
FileOpsJob(FmFileOpsJob* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
FileOpsJob(const FileOpsJob& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
FileOpsJob(FileOpsJob&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// create a wrapper for the data pointer without increasing the reference count
static FileOpsJob wrapPtr(FmFileOpsJob* dataPtr) {
FileOpsJob obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmFileOpsJob* takeDataPtr() {
FmFileOpsJob* data = reinterpret_cast<FmFileOpsJob*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmFileOpsJob* dataPtr() {
return reinterpret_cast<FmFileOpsJob*>(dataPtr_);
}
// automatic type casting
operator FmFileOpsJob*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
FileOpsJob& operator=(const FileOpsJob& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
FileOpsJob& operator=(FileOpsJob&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
FmFileOpOption getOptions(void) {
return fm_file_ops_job_get_options(dataPtr());
}
FmFileOpOption askRename(GFile* src, GFileInfo* src_inf, GFile* dest, GFile** new_dest) {
return fm_file_ops_job_ask_rename(dataPtr(), src, src_inf, dest, new_dest);
}
void emitPercent(void) {
fm_file_ops_job_emit_percent(dataPtr());
}
void emitCurFile(const char* cur_file) {
fm_file_ops_job_emit_cur_file(dataPtr(), cur_file);
}
void emitPrepared(void) {
fm_file_ops_job_emit_prepared(dataPtr());
}
void setTarget(const char* url) {
fm_file_ops_job_set_target(dataPtr(), url);
}
void setHidden(gboolean hidden) {
fm_file_ops_job_set_hidden(dataPtr(), hidden);
}
void setIcon(GIcon* icon) {
fm_file_ops_job_set_icon(dataPtr(), icon);
}
void setDisplayName(const char* name) {
fm_file_ops_job_set_display_name(dataPtr(), name);
}
void setChown(gint uid, gint gid) {
fm_file_ops_job_set_chown(dataPtr(), uid, gid);
}
void setChmod(mode_t new_mode, mode_t new_mode_mask) {
fm_file_ops_job_set_chmod(dataPtr(), new_mode, new_mode_mask);
}
void setRecursive(gboolean recursive) {
fm_file_ops_job_set_recursive(dataPtr(), recursive);
}
FmPath* getDest(void) {
return fm_file_ops_job_get_dest(dataPtr());
}
void setDest(FmPath* dest) {
fm_file_ops_job_set_dest(dataPtr(), dest);
}
};
}
#endif // __LIBFM_QT_FM_FILE_OPS_JOB_H__

@ -46,9 +46,9 @@ enum {
FilePropsDialog::FilePropsDialog(FmFileInfoList* files, QWidget* parent, Qt::WindowFlags f):
QDialog(parent, f),
fileInfos_(fm_file_info_list_ref(files)),
fileInfo(fm_file_info_list_peek_head(files)),
singleType(fm_file_info_list_is_same_type(files)),
singleFile(fm_file_info_list_get_length(files) == 1 ? true:false),
fileInfo(fm_file_info_list_peek_head(files)),
mimeType(NULL) {
setAttribute(Qt::WA_DeleteOnClose);
@ -69,17 +69,26 @@ FilePropsDialog::FilePropsDialog(FmFileInfoList* files, QWidget* parent, Qt::Win
}
FilePropsDialog::~FilePropsDialog() {
delete ui;
if(fileInfos_)
fm_file_info_list_unref(fileInfos_);
if(deepCountJob)
g_object_unref(deepCountJob);
// Stop the timer if it's still running
if(fileSizeTimer) {
fileSizeTimer->stop();
delete fileSizeTimer;
fileSizeTimer = NULL;
}
// Cancel the indexing job if it hasn't finished
if(deepCountJob) {
g_signal_handlers_disconnect_by_func(deepCountJob, (gpointer)G_CALLBACK(onDeepCountJobFinished), this);
fm_job_cancel(FM_JOB(deepCountJob));
g_object_unref(deepCountJob);
deepCountJob = NULL;
}
// And finally delete the dialog's UI
delete ui;
}
void FilePropsDialog::initApplications() {
@ -295,7 +304,7 @@ void FilePropsDialog::initGeneralPage() {
connect(fileSizeTimer, &QTimer::timeout, this, &FilePropsDialog::onFileSizeTimerTimeout);
fileSizeTimer->start(600);
g_signal_connect(deepCountJob, "finished", G_CALLBACK(onDeepCountJobFinished), this);
gboolean ret = fm_job_run_async(FM_JOB(deepCountJob));
fm_job_run_async(FM_JOB(deepCountJob));
}
/*static */ void FilePropsDialog::onDeepCountJobFinished(FmDeepCountJob* job, FilePropsDialog* pThis) {
@ -423,6 +432,29 @@ void FilePropsDialog::accept() {
op->run();
}
// Renaming
if(singleFile) {
QString new_name = ui->fileName->text();
if(QString::fromUtf8(fm_file_info_get_disp_name(fileInfo)) != new_name) {
FmPath* path = fm_file_info_get_path(fileInfo);
GFile* gf = fm_path_to_gfile(path);
GFile* parent_gf = g_file_get_parent(gf);
GFile* dest = g_file_get_child(G_FILE(parent_gf), new_name.toLocal8Bit().data());
g_object_unref(parent_gf);
GError* err = NULL;
if(!g_file_move(gf, dest,
GFileCopyFlags(G_FILE_COPY_ALL_METADATA |
G_FILE_COPY_NO_FALLBACK_FOR_MOVE |
G_FILE_COPY_NOFOLLOW_SYMLINKS),
NULL, NULL, NULL, &err)) {
QMessageBox::critical(this, QObject::tr("Error"), err->message);
g_error_free(err);
}
g_object_unref(dest);
g_object_unref(gf);
}
}
QDialog::accept();
}

@ -23,6 +23,7 @@
#include "ui_filesearch.h"
#include <limits>
#include <QFileDialog>
#include <utility>
namespace Fm {
@ -54,8 +55,7 @@ void FileSearchDialog::accept() {
int n = ui->listView->count();
if(n > 0) {
FmSearch* search = fm_search_new();
int i;
for(i = 0; i < n; ++i) { // add directories
for(int i = 0; i < n; ++i) { // add directories
QListWidgetItem* item = ui->listView->item(i);
fm_search_add_dir(search, item->text().toLocal8Bit().constData());
}
@ -90,7 +90,7 @@ void FileSearchDialog::accept() {
"application/msword;application/vnd.ms-word",
"application/msexcel;application/vnd.ms-excel"
};
for(i = 0; i < sizeof(doc_types)/sizeof(char*); ++i)
for(unsigned int i = 0; i < sizeof(doc_types)/sizeof(char*); ++i)
fm_search_add_mime_type(search, doc_types[i]);
}
@ -114,12 +114,12 @@ void FileSearchDialog::accept() {
fm_search_set_min_mtime(search, ui->minTime->date().toString(QStringLiteral("yyyy-MM-dd")).toUtf8().constData());
}
searchUri_.take(fm_search_dup_path(search));
searchUri_ = std::move(Path::wrapPtr(fm_search_dup_path(search)));
fm_search_free(search);
}
else {
QMessageBox::critical(this, tr("Error"), tr("You should add at least add one directory to search."));
QMessageBox::critical(this, tr("Error"), tr("You should add at least one directory to search."));
return;
}
QDialog::accept();

@ -0,0 +1,228 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_FOLDER_H__
#define __LIBFM_QT_FM_FOLDER_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API Folder {
public:
// default constructor
Folder() {
dataPtr_ = nullptr;
}
Folder(FmFolder* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
Folder(const Folder& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
Folder(Folder&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// destructor
virtual ~Folder() {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static Folder wrapPtr(FmFolder* dataPtr) {
Folder obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmFolder* takeDataPtr() {
FmFolder* data = reinterpret_cast<FmFolder*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmFolder* dataPtr() {
return reinterpret_cast<FmFolder*>(dataPtr_);
}
// automatic type casting
operator FmFolder*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
Folder& operator=(const Folder& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
Folder& operator=(Folder&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
bool makeDirectory(const char* name, GError** error) {
return fm_folder_make_directory(dataPtr(), name, error);
}
void queryFilesystemInfo(void) {
fm_folder_query_filesystem_info(dataPtr());
}
bool getFilesystemInfo(guint64* total_size, guint64* free_size) {
return fm_folder_get_filesystem_info(dataPtr(), total_size, free_size);
}
void reload(void) {
fm_folder_reload(dataPtr());
}
bool isIncremental(void) {
return fm_folder_is_incremental(dataPtr());
}
bool isValid(void) {
return fm_folder_is_valid(dataPtr());
}
bool isLoaded(void) {
return fm_folder_is_loaded(dataPtr());
}
FmFileInfo* getFileByName(const char* name) {
return fm_folder_get_file_by_name(dataPtr(), name);
}
bool isEmpty(void) {
return fm_folder_is_empty(dataPtr());
}
FmFileInfoList* getFiles(void) {
return fm_folder_get_files(dataPtr());
}
FmPath* getPath(void) {
return fm_folder_get_path(dataPtr());
}
FmFileInfo* getInfo(void) {
return fm_folder_get_info(dataPtr());
}
void unblockUpdates(void) {
fm_folder_unblock_updates(dataPtr());
}
void blockUpdates(void) {
fm_folder_block_updates(dataPtr());
}
static Folder findByPath(FmPath* path) {
return Folder::wrapPtr(fm_folder_find_by_path(path));
}
static Folder fromUri(const char* uri) {
return Folder::wrapPtr(fm_folder_from_uri(uri));
}
static Folder fromPathName(const char* path) {
return Folder::wrapPtr(fm_folder_from_path_name(path));
}
static Folder fromGfile(GFile* gf) {
return Folder::wrapPtr(fm_folder_from_gfile(gf));
}
static Folder fromPath(FmPath* path) {
return Folder::wrapPtr(fm_folder_from_path(path));
}
// automatic type casting for GObject
operator GObject*() {
return reinterpret_cast<GObject*>(dataPtr_);
}
protected:
GObject* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_FOLDER_H__

@ -0,0 +1,198 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_FOLDER_CONFIG_H__
#define __LIBFM_QT_FM_FOLDER_CONFIG_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API FolderConfig {
public:
FolderConfig(FmPath* path) {
dataPtr_ = reinterpret_cast<FmFolderConfig*>(fm_folder_config_open(path));
}
// default constructor
FolderConfig() {
dataPtr_ = nullptr;
}
// move constructor
FolderConfig(FolderConfig&& other) {
dataPtr_ = reinterpret_cast<FmFolderConfig*>(other.takeDataPtr());
}
// destructor
~FolderConfig() {
if(dataPtr_ != nullptr) {
fm_folder_config_close(dataPtr_, nullptr);
}
}
// create a wrapper for the data pointer without increasing the reference count
static FolderConfig wrapPtr(FmFolderConfig* dataPtr) {
FolderConfig obj;
obj.dataPtr_ = reinterpret_cast<FmFolderConfig*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmFolderConfig* takeDataPtr() {
FmFolderConfig* data = reinterpret_cast<FmFolderConfig*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmFolderConfig* dataPtr() {
return reinterpret_cast<FmFolderConfig*>(dataPtr_);
}
// automatic type casting
operator FmFolderConfig*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// move assignment
FolderConfig& operator=(FolderConfig&& other) {
dataPtr_ = reinterpret_cast<FmFolderConfig*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
static void saveCache(void ) {
fm_folder_config_save_cache();
}
void purge(void) {
fm_folder_config_purge(dataPtr());
}
void removeKey(const char* key) {
fm_folder_config_remove_key(dataPtr(), key);
}
void setStringList(const char* key, const gchar * const list[], gsize length) {
fm_folder_config_set_string_list(dataPtr(), key, list, length);
}
void setString(const char* key, const char* string) {
fm_folder_config_set_string(dataPtr(), key, string);
}
void setBoolean(const char* key, gboolean val) {
fm_folder_config_set_boolean(dataPtr(), key, val);
}
void setDouble(const char* key, gdouble val) {
fm_folder_config_set_double(dataPtr(), key, val);
}
void setUint64(const char* key, guint64 val) {
fm_folder_config_set_uint64(dataPtr(), key, val);
}
void setInteger(const char* key, gint val) {
fm_folder_config_set_integer(dataPtr(), key, val);
}
char** getStringList(const char* key, gsize* length) {
return fm_folder_config_get_string_list(dataPtr(), key, length);
}
char* getString(const char* key) {
return fm_folder_config_get_string(dataPtr(), key);
}
bool getBoolean(const char* key, gboolean* val) {
return fm_folder_config_get_boolean(dataPtr(), key, val);
}
bool getDouble(const char* key, gdouble* val) {
return fm_folder_config_get_double(dataPtr(), key, val);
}
bool getUint64(const char* key, guint64* val) {
return fm_folder_config_get_uint64(dataPtr(), key, val);
}
bool getInteger(const char* key, gint* val) {
return fm_folder_config_get_integer(dataPtr(), key, val);
}
bool isEmpty(void) {
return fm_folder_config_is_empty(dataPtr());
}
// the wrapped object cannot be copied.
private:
FolderConfig(const FolderConfig& other) = delete;
FolderConfig& operator=(const FolderConfig& other) = delete;
private:
FmFolderConfig* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_FOLDER_CONFIG_H__

@ -22,7 +22,7 @@
#include "foldermodel.h"
#include <QPainter>
#include <QModelIndex>
#include <QStyleOptionViewItemV4>
#include <QStyleOptionViewItem>
#include <QApplication>
#include <QIcon>
#include <QTextLayout>
@ -34,8 +34,8 @@ namespace Fm {
FolderItemDelegate::FolderItemDelegate(QAbstractItemView* view, QObject* parent):
QStyledItemDelegate(parent ? parent : view),
symlinkIcon_(QIcon::fromTheme("emblem-symbolic-link")),
view_(view) {
view_(view),
symlinkIcon_(QIcon::fromTheme("emblem-symbolic-link")) {
}
FolderItemDelegate::~FolderItemDelegate() {
@ -49,16 +49,19 @@ QSize FolderItemDelegate::sizeHint(const QStyleOptionViewItem& option, const QMo
if(option.decorationPosition == QStyleOptionViewItem::Top ||
option.decorationPosition == QStyleOptionViewItem::Bottom) {
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
opt.decorationAlignment = Qt::AlignHCenter|Qt::AlignTop;
opt.displayAlignment = Qt::AlignTop|Qt::AlignHCenter;
// "opt.decorationSize" may be smaller than the requested size because
// "QStyledItemDelegate::initStyleOption()" uses "QIcon::actualSize()" to set it
// (see Qt -> qstyleditemdelegate.cpp). So, we always get decorationSize from "option".
Q_ASSERT(gridSize_ != QSize());
QRectF textRect(0, 0, gridSize_.width(), gridSize_.height() - opt.decorationSize.height());
QRectF textRect(0, 0, gridSize_.width(), gridSize_.height() - option.decorationSize.height());
drawText(nullptr, opt, textRect); // passing NULL for painter will calculate the bounding rect only.
int width = qMax((int)textRect.width(), opt.decorationSize.width());
int height = opt.decorationSize.height() + textRect.height();
int width = qMax((int)textRect.width(), option.decorationSize.width());
int height = option.decorationSize.height() + textRect.height();
return QSize(width, height);
}
return QStyledItemDelegate::sizeHint(option, index);
@ -83,28 +86,30 @@ void FolderItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& op
painter->save();
painter->setClipRect(option.rect);
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
opt.decorationAlignment = Qt::AlignHCenter|Qt::AlignTop;
opt.displayAlignment = Qt::AlignTop|Qt::AlignHCenter;
// draw the icon
QIcon::Mode iconMode = iconModeFromState(opt.state);
QPoint iconPos(opt.rect.x() + (opt.rect.width() - opt.decorationSize.width()) / 2, opt.rect.y());
QPixmap pixmap = opt.icon.pixmap(opt.decorationSize, iconMode);
painter->drawPixmap(iconPos, pixmap);
QPoint iconPos(opt.rect.x() + (opt.rect.width() - option.decorationSize.width()) / 2, opt.rect.y());
QPixmap pixmap = opt.icon.pixmap(option.decorationSize, iconMode);
// in case the pixmap is smaller than the requested size
QSize margin = ((option.decorationSize - pixmap.size()) / 2).expandedTo(QSize(0, 0));
painter->drawPixmap(iconPos + QPoint(margin.width(), margin.height()), pixmap);
// draw some emblems for the item if needed
// we only support symlink emblem at the moment
if(isSymlink)
painter->drawPixmap(iconPos, symlinkIcon_.pixmap(opt.decorationSize / 2, iconMode));
painter->drawPixmap(iconPos, symlinkIcon_.pixmap(option.decorationSize / 2, iconMode));
// draw the text
// The text rect dimensions should be exactly as they were in sizeHint()
QRectF textRect(opt.rect.x() - (gridSize_.width() - opt.rect.width()) / 2,
opt.rect.y() + opt.decorationSize.height(),
opt.rect.y() + option.decorationSize.height(),
gridSize_.width(),
gridSize_.height() - opt.decorationSize.height());
gridSize_.height() - option.decorationSize.height());
drawText(painter, opt, textRect);
painter->restore();
}
@ -114,24 +119,27 @@ void FolderItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& op
// draw emblems if needed
if(isSymlink) {
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
QIcon::Mode iconMode = iconModeFromState(opt.state);
QPoint iconPos(opt.rect.x(), opt.rect.y() + (opt.rect.height() - opt.decorationSize.height()) / 2);
QPoint iconPos(opt.rect.x(), opt.rect.y() + (opt.rect.height() - option.decorationSize.height()) / 2);
// draw some emblems for the item if needed
// we only support symlink emblem at the moment
painter->drawPixmap(iconPos, symlinkIcon_.pixmap(opt.decorationSize / 2, iconMode));
painter->drawPixmap(iconPos, symlinkIcon_.pixmap(option.decorationSize / 2, iconMode));
}
}
}
// if painter is nullptr, the method calculate the bounding rectangle of the text and save it to textRect
void FolderItemDelegate::drawText(QPainter* painter, QStyleOptionViewItemV4& opt, QRectF& textRect) const {
void FolderItemDelegate::drawText(QPainter* painter, QStyleOptionViewItem& opt, QRectF& textRect) const {
QTextLayout layout(opt.text, opt.font);
QTextOption textOption;
textOption.setAlignment(opt.displayAlignment);
textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
textOption.setTextDirection(opt.direction);
if (opt.text.isRightToLeft())
textOption.setTextDirection(Qt::RightToLeft);
else
textOption.setTextDirection(Qt::LeftToRight);
layout.setTextOption(textOption);
qreal height = 0;
qreal width = 0;
@ -188,7 +196,7 @@ void FolderItemDelegate::drawText(QPainter* painter, QStyleOptionViewItemV4& opt
if (opt.state & QStyle::State_Selected || opt.state & QStyle::State_MouseOver) {
if (const QWidget* widget = opt.widget) { // let the style engine do it
QStyle* style = widget->style() ? widget->style() : qApp->style();
QStyleOptionViewItemV4 o(opt);
QStyleOptionViewItem o(opt);
o.text = QString();
o.rect = selRect.toAlignedRect().intersected(opt.rect); // due to clipping and rounding, we might lose 1px
o.showDecorationSelected = true;

@ -45,7 +45,7 @@ public:
virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
private:
void drawText(QPainter* painter, QStyleOptionViewItemV4& opt, QRectF& textRect) const;
void drawText(QPainter* painter, QStyleOptionViewItem& opt, QRectF& textRect) const;
static QIcon::Mode iconModeFromState(QStyle::State state);
private:

@ -115,10 +115,12 @@ void FolderMenu::addCustomActionItem(QMenu* menu, FmFileActionItem* item) {
menu->addAction(action);
if(fm_file_action_item_is_menu(item)) {
GList* subitems = fm_file_action_item_get_sub_items(item);
if (subitems != NULL) {
QMenu* submenu = new QMenu(menu);
for(GList* l = subitems; l; l = l->next) {
FmFileActionItem* subitem = FM_FILE_ACTION_ITEM(l->data);
QMenu* submenu = new QMenu(menu);
addCustomActionItem(submenu, subitem);
}
action->setMenu(submenu);
}
}

@ -181,8 +181,8 @@ void FolderViewListView::activation(const QModelIndex &index) {
FolderViewTreeView::FolderViewTreeView(QWidget* parent):
QTreeView(parent),
layoutTimer_(nullptr),
doingLayout_(false),
layoutTimer_(nullptr),
activationAllowed_(true) {
header()->setStretchLastSection(true);
@ -388,12 +388,12 @@ void FolderViewTreeView::onSortFilterChanged() {
FolderView::FolderView(ViewMode _mode, QWidget* parent):
QWidget(parent),
view(nullptr),
model_(nullptr),
mode((ViewMode)0),
fileLauncher_(nullptr),
autoSelectionDelay_(600),
autoSelectionTimer_(nullptr),
selChangedTimer_(nullptr),
fileLauncher_(nullptr),
model_(nullptr),
itemDelegateMargins_(QSize(3, 3)) {
iconSize_[IconMode - FirstViewMode] = QSize(48, 48);
@ -500,6 +500,11 @@ void FolderView::setViewMode(ViewMode _mode) {
listView->setItemDelegateForColumn(FolderModel::ColumnFileName, delegate);
// FIXME: should we expose the delegate?
listView->setMovement(QListView::Static);
/* If listView is already visible, setMovement() will lay out items again with delay
(see Qt, QListView::setMovement(), d->doDelayedItemsLayout()) and thus drop events
will remain disabled for the viewport. So, we should re-enable drop events here. */
if(listView->viewport()->isVisible())
listView->viewport()->setAcceptDrops(true);
listView->setResizeMode(QListView::Adjust);
listView->setWrapping(true);
switch(mode) {
@ -651,7 +656,8 @@ bool FolderView::event(QEvent* event) {
case QEvent::FontChange:
updateGridSize();
break;
};
default: break;
}
return QWidget::event(event);
}
@ -715,15 +721,15 @@ QItemSelectionModel* FolderView::selectionModel() const {
return view ? view->selectionModel() : nullptr;
}
FmPathList* FolderView::selectedFilePaths() const {
Fm::PathList FolderView::selectedFilePaths() const {
if(model_) {
QModelIndexList selIndexes = mode == DetailedListMode ? selectedRows() : selectedIndexes();
if(!selIndexes.isEmpty()) {
FmPathList* paths = fm_path_list_new();
PathList paths;
QModelIndexList::const_iterator it;
for(it = selIndexes.begin(); it != selIndexes.end(); ++it) {
FmFileInfo* file = model_->fileInfoFromIndex(*it);
fm_path_list_push_tail(paths, fm_file_info_get_path(file));
paths.pushTail(fm_file_info_get_path(file));
}
return paths;
}
@ -744,15 +750,15 @@ QModelIndex FolderView::indexFromFolderPath(FmPath* folderPath) const {
return QModelIndex();
}
FmFileInfoList* FolderView::selectedFiles() const {
Fm::FileInfoList FolderView::selectedFiles() const {
if(model_) {
QModelIndexList selIndexes = mode == DetailedListMode ? selectedRows() : selectedIndexes();
if(!selIndexes.isEmpty()) {
FmFileInfoList* files = fm_file_info_list_new();
FileInfoList files;
QModelIndexList::const_iterator it;
for(it = selIndexes.constBegin(); it != selIndexes.constEnd(); ++it) {
FmFileInfo* file = model_->fileInfoFromIndex(*it);
fm_file_info_list_push_tail(files, file);
files.pushTail(file);
}
return files;
}
@ -825,10 +831,9 @@ void FolderView::childDropEvent(QDropEvent* e) {
const QWidget* targetWidget = childView()->viewport();
// these are dynamic QObject property set by our XDND workarounds in xworkaround.cpp.
xcb_window_t dndSource = xcb_window_t(targetWidget->property("xdnd::lastDragSource").toUInt());
xcb_timestamp_t dropTimestamp = (xcb_timestamp_t)targetWidget->property("xdnd::lastDropTime").toUInt();
//xcb_timestamp_t dropTimestamp = (xcb_timestamp_t)targetWidget->property("xdnd::lastDropTime").toUInt();
// qDebug() << "XDS: source window" << dndSource << dropTimestamp;
if(dndSource != 0) {
xcb_connection_t* conn = QX11Info::connection();
xcb_atom_t XdndDirectSaveAtom = XdndWorkaround::internAtom("XdndDirectSave0", 15);
xcb_atom_t textAtom = XdndWorkaround::internAtom("text/plain", 10);
@ -836,7 +841,7 @@ void FolderView::childDropEvent(QDropEvent* e) {
QByteArray basename = XdndWorkaround::windowProperty(dndSource, XdndDirectSaveAtom, textAtom, 1024);
// 2. construct the fill URI for the file, and update the source window property.
Path filePath = Path(path()).child(basename);
Path filePath = Path(path()).newChild(basename);
QByteArray fileUri = filePath.toUri();
XdndWorkaround::setWindowProperty(dndSource, XdndDirectSaveAtom, textAtom, (void*)fileUri.constData(), fileUri.length());
@ -918,6 +923,7 @@ bool FolderView::eventFilter(QObject* watched, QEvent* event) {
}
}
break;
default: break;
}
}
return QObject::eventFilter(watched, event);
@ -994,10 +1000,10 @@ void FolderView::onFileClicked(int type, FmFileInfo* fileInfo) {
}
else if(type == ContextMenuClick) {
FmPath* folderPath = nullptr;
FmFileInfoList* files = selectedFiles();
if (files) {
FmFileInfo* first = fm_file_info_list_peek_head(files);
if (fm_file_info_list_get_length(files) == 1 && fm_file_info_is_dir(first))
FileInfoList files = selectedFiles();
if (!files.isNull()) {
FmFileInfo* first = files.peekHead();
if (files.getLength() == 1 && fm_file_info_is_dir(first))
folderPath = fm_file_info_get_path(first);
}
if (!folderPath)
@ -1005,11 +1011,11 @@ void FolderView::onFileClicked(int type, FmFileInfo* fileInfo) {
QMenu* menu = nullptr;
if(fileInfo) {
// show context menu
if (FmFileInfoList* files = selectedFiles()) {
Fm::FileMenu* fileMenu = new Fm::FileMenu(files, fileInfo, folderPath);
FileInfoList files = selectedFiles();
if (!files.isNull()) {
Fm::FileMenu* fileMenu = new Fm::FileMenu(files.dataPtr(), fileInfo, folderPath);
fileMenu->setFileLauncher(fileLauncher_);
prepareFileMenu(fileMenu);
fm_file_info_list_unref(files);
menu = fileMenu;
}
}

@ -29,6 +29,8 @@
#include <libfm/fm.h>
#include "foldermodel.h"
#include "proxyfoldermodel.h"
#include "fileinfo.h"
#include "path.h"
class QTimer;
@ -92,8 +94,8 @@ public:
}
QItemSelectionModel* selectionModel() const;
FmFileInfoList* selectedFiles() const;
FmPathList* selectedFilePaths() const;
Fm::FileInfoList selectedFiles() const;
Fm::PathList selectedFilePaths() const;
QModelIndex indexFromFolderPath(FmPath* folderPath) const;
void selectAll();

@ -0,0 +1,168 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_ICON_H__
#define __LIBFM_QT_FM_ICON_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API Icon {
public:
// default constructor
Icon() {
dataPtr_ = nullptr;
}
Icon(FmIcon* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmIcon*>(fm_icon_ref(dataPtr)) : nullptr;
}
// copy constructor
Icon(const Icon& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmIcon*>(fm_icon_ref(other.dataPtr_)) : nullptr;
}
// move constructor
Icon(Icon&& other) {
dataPtr_ = reinterpret_cast<FmIcon*>(other.takeDataPtr());
}
// destructor
~Icon() {
if(dataPtr_ != nullptr) {
fm_icon_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static Icon wrapPtr(FmIcon* dataPtr) {
Icon obj;
obj.dataPtr_ = reinterpret_cast<FmIcon*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmIcon* takeDataPtr() {
FmIcon* data = reinterpret_cast<FmIcon*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmIcon* dataPtr() {
return reinterpret_cast<FmIcon*>(dataPtr_);
}
// automatic type casting
operator FmIcon*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
Icon& operator=(const Icon& other) {
if(dataPtr_ != nullptr) {
fm_icon_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmIcon*>(fm_icon_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
Icon& operator=(Icon&& other) {
dataPtr_ = reinterpret_cast<FmIcon*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
static void unloadCache( ) {
fm_icon_unload_cache();
}
static void resetUserDataCache(GQuark quark) {
fm_icon_reset_user_data_cache(quark);
}
static void unloadUserDataCache( ) {
fm_icon_unload_user_data_cache();
}
static void setUserDataDestroy(GDestroyNotify func) {
fm_icon_set_user_data_destroy(func);
}
void setUserData(gpointer user_data) {
fm_icon_set_user_data(dataPtr(), user_data);
}
gpointer getUserData(void) {
return fm_icon_get_user_data(dataPtr());
}
static Icon fromName(const char* name) {
return Icon::wrapPtr(fm_icon_from_name(name));
}
static Icon fromGicon(GIcon* gicon) {
return Icon::wrapPtr(fm_icon_from_gicon(gicon));
}
private:
FmIcon* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_ICON_H__

@ -0,0 +1,225 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_JOB_H__
#define __LIBFM_QT_FM_JOB_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API Job {
public:
// default constructor
Job() {
dataPtr_ = nullptr;
}
Job(FmJob* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
Job(const Job& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
Job(Job&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// destructor
virtual ~Job() {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static Job wrapPtr(FmJob* dataPtr) {
Job obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmJob* takeDataPtr() {
FmJob* data = reinterpret_cast<FmJob*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmJob* dataPtr() {
return reinterpret_cast<FmJob*>(dataPtr_);
}
// automatic type casting
operator FmJob*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
Job& operator=(const Job& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
Job& operator=(Job&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
void resume(void) {
fm_job_resume(dataPtr());
}
bool pause(void) {
return fm_job_pause(dataPtr());
}
int askValist(const char* question, va_list options) {
return fm_job_ask_valist(dataPtr(), question, options);
}
int askv(const char* question, gchar* const* options) {
return fm_job_askv(dataPtr(), question, options);
}
int ask(const char* question, ... ) {
int ret;
va_list args;
va_start (args, question);
ret = fm_job_ask_valist(dataPtr(), question, args);
va_end (args);
return ret;
}
FmJobErrorAction emitError(GError* err, FmJobErrorSeverity severity) {
return fm_job_emit_error(dataPtr(), err, severity);
}
void finish(void) {
fm_job_finish(dataPtr());
}
void setCancellable(GCancellable* cancellable) {
fm_job_set_cancellable(dataPtr(), cancellable);
}
GCancellable* getCancellable(void) {
return fm_job_get_cancellable(dataPtr());
}
void initCancellable(void) {
fm_job_init_cancellable(dataPtr());
}
gpointer callMainThread(FmJobCallMainThreadFunc func, gpointer user_data) {
return fm_job_call_main_thread(dataPtr(), func, user_data);
}
void cancel(void) {
fm_job_cancel(dataPtr());
}
bool runSyncWithMainloop(void) {
return fm_job_run_sync_with_mainloop(dataPtr());
}
bool runSync(void) {
return fm_job_run_sync(dataPtr());
}
bool runAsync(void) {
return fm_job_run_async(dataPtr());
}
bool isRunning(void) {
return fm_job_is_running(dataPtr());
}
bool isCancelled(void) {
return fm_job_is_cancelled(dataPtr());
}
// automatic type casting for GObject
operator GObject*() {
return reinterpret_cast<GObject*>(dataPtr_);
}
protected:
GObject* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_JOB_H__

@ -0,0 +1,153 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_LIST_H__
#define __LIBFM_QT_FM_LIST_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API List {
public:
List(FmListFuncs* funcs) {
dataPtr_ = reinterpret_cast<FmList*>(fm_list_new(funcs));
}
// default constructor
List() {
dataPtr_ = nullptr;
}
List(FmList* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmList*>(fm_list_ref(dataPtr)) : nullptr;
}
// copy constructor
List(const List& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmList*>(fm_list_ref(other.dataPtr_)) : nullptr;
}
// move constructor
List(List&& other) {
dataPtr_ = reinterpret_cast<FmList*>(other.takeDataPtr());
}
// destructor
~List() {
if(dataPtr_ != nullptr) {
fm_list_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static List wrapPtr(FmList* dataPtr) {
List obj;
obj.dataPtr_ = reinterpret_cast<FmList*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmList* takeDataPtr() {
FmList* data = reinterpret_cast<FmList*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmList* dataPtr() {
return reinterpret_cast<FmList*>(dataPtr_);
}
// automatic type casting
operator FmList*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
List& operator=(const List& other) {
if(dataPtr_ != nullptr) {
fm_list_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmList*>(fm_list_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
List& operator=(List&& other) {
dataPtr_ = reinterpret_cast<FmList*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
void deleteLink(GList* l_) {
fm_list_delete_link(dataPtr(), l_);
}
void removeAll(gpointer data) {
fm_list_remove_all(dataPtr(), data);
}
void remove(gpointer data) {
fm_list_remove(dataPtr(), data);
}
void clear(void) {
fm_list_clear(dataPtr());
}
private:
FmList* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_LIST_H__

@ -0,0 +1,163 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_MIME_TYPE_H__
#define __LIBFM_QT_FM_MIME_TYPE_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API MimeType {
public:
// default constructor
MimeType() {
dataPtr_ = nullptr;
}
MimeType(FmMimeType* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmMimeType*>(fm_mime_type_ref(dataPtr)) : nullptr;
}
// copy constructor
MimeType(const MimeType& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmMimeType*>(fm_mime_type_ref(other.dataPtr_)) : nullptr;
}
// move constructor
MimeType(MimeType&& other) {
dataPtr_ = reinterpret_cast<FmMimeType*>(other.takeDataPtr());
}
// destructor
~MimeType() {
if(dataPtr_ != nullptr) {
fm_mime_type_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static MimeType wrapPtr(FmMimeType* dataPtr) {
MimeType obj;
obj.dataPtr_ = reinterpret_cast<FmMimeType*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmMimeType* takeDataPtr() {
FmMimeType* data = reinterpret_cast<FmMimeType*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmMimeType* dataPtr() {
return reinterpret_cast<FmMimeType*>(dataPtr_);
}
// automatic type casting
operator FmMimeType*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
MimeType& operator=(const MimeType& other) {
if(dataPtr_ != nullptr) {
fm_mime_type_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmMimeType*>(fm_mime_type_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
MimeType& operator=(MimeType&& other) {
dataPtr_ = reinterpret_cast<FmMimeType*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
void removeThumbnailer(gpointer thumbnailer) {
fm_mime_type_remove_thumbnailer(dataPtr(), thumbnailer);
}
void addThumbnailer(gpointer thumbnailer) {
fm_mime_type_add_thumbnailer(dataPtr(), thumbnailer);
}
GList* getThumbnailersList(void) {
return fm_mime_type_get_thumbnailers_list(dataPtr());
}
FmIcon* getIcon(void) {
return fm_mime_type_get_icon(dataPtr());
}
static MimeType fromName(const char* type) {
return MimeType::wrapPtr(fm_mime_type_from_name(type));
}
static MimeType fromNativeFile(const char* file_path, const char* base_name, struct stat* pstat) {
return MimeType::wrapPtr(fm_mime_type_from_native_file(file_path, base_name, pstat));
}
static MimeType fromFileName(const char* ufile_name) {
return MimeType::wrapPtr(fm_mime_type_from_file_name(ufile_name));
}
private:
FmMimeType* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_MIME_TYPE_H__

@ -163,6 +163,16 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>Anonymous</tabstop>
<tabstop>asUser</tabstop>
<tabstop>username</tabstop>
<tabstop>domain</tabstop>
<tabstop>password</tabstop>
<tabstop>forgetPassword</tabstop>
<tabstop>sessionPassword</tabstop>
<tabstop>storePassword</tabstop>
</tabstops>
<resources/>
<connections>
<connection>

@ -31,10 +31,10 @@ namespace Fm {
MountOperation::MountOperation(bool interactive, QWidget* parent):
QObject(parent),
interactive_(interactive),
running(false),
op(g_mount_operation_new()),
cancellable_(g_cancellable_new()),
running(false),
interactive_(interactive),
eventLoop(NULL),
autoDestroy_(true) {

@ -27,11 +27,11 @@ namespace Fm {
MountOperationPasswordDialog::MountOperationPasswordDialog(MountOperation* op, GAskPasswordFlags flags):
QDialog(),
mountOperation(op),
canAnonymous(flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED ? true : false),
canSavePassword(flags & G_ASK_PASSWORD_SAVING_SUPPORTED ? true : false),
needUserName(flags & G_ASK_PASSWORD_NEED_USERNAME ? true : false),
needPassword(flags & G_ASK_PASSWORD_NEED_PASSWORD ? true : false),
needDomain(flags & G_ASK_PASSWORD_NEED_DOMAIN ? true : false) {
needUserName(flags & G_ASK_PASSWORD_NEED_USERNAME ? true : false),
needDomain(flags & G_ASK_PASSWORD_NEED_DOMAIN ? true : false),
canSavePassword(flags & G_ASK_PASSWORD_SAVING_SUPPORTED ? true : false),
canAnonymous(flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED ? true : false) {
ui = new Ui::MountOperationPasswordDialog();
ui->setupUi(this);

@ -0,0 +1,192 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_NAV_HISTORY_H__
#define __LIBFM_QT_FM_NAV_HISTORY_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API NavHistory {
public:
NavHistory(void ) {
dataPtr_ = reinterpret_cast<GObject*>(fm_nav_history_new());
}
NavHistory(FmNavHistory* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
NavHistory(const NavHistory& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
NavHistory(NavHistory&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// destructor
virtual ~NavHistory() {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static NavHistory wrapPtr(FmNavHistory* dataPtr) {
NavHistory obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmNavHistory* takeDataPtr() {
FmNavHistory* data = reinterpret_cast<FmNavHistory*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmNavHistory* dataPtr() {
return reinterpret_cast<FmNavHistory*>(dataPtr_);
}
// automatic type casting
operator FmNavHistory*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
NavHistory& operator=(const NavHistory& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
NavHistory& operator=(NavHistory&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
void setMax(guint num) {
fm_nav_history_set_max(dataPtr(), num);
}
void clear(void) {
fm_nav_history_clear(dataPtr());
}
void chdir(FmPath* path, gint old_scroll_pos) {
fm_nav_history_chdir(dataPtr(), path, old_scroll_pos);
}
bool canBack(void) {
return fm_nav_history_can_back(dataPtr());
}
int getScrollPos(void) {
return fm_nav_history_get_scroll_pos(dataPtr());
}
FmPath* goTo(guint n, gint old_scroll_pos) {
return fm_nav_history_go_to(dataPtr(), n, old_scroll_pos);
}
FmPath* getNthPath(guint n) {
return fm_nav_history_get_nth_path(dataPtr(), n);
}
unsigned int getCurIndex(void) {
return fm_nav_history_get_cur_index(dataPtr());
}
void jump(GList* l, int old_scroll_pos) {
fm_nav_history_jump(dataPtr(), l, old_scroll_pos);
}
void forward(int old_scroll_pos) {
fm_nav_history_forward(dataPtr(), old_scroll_pos);
}
bool canForward(void) {
return fm_nav_history_can_forward(dataPtr());
}
void back(int old_scroll_pos) {
fm_nav_history_back(dataPtr(), old_scroll_pos);
}
// automatic type casting for GObject
operator GObject*() {
return reinterpret_cast<GObject*>(dataPtr_);
}
protected:
GObject* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_NAV_HISTORY_H__

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013 - 2015 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -17,231 +17,425 @@
*
*/
#ifndef FM_PATH_H
#define FM_PATH_H
#ifndef __LIBFM_QT_FM_PATH_H__
#define __LIBFM_QT_FM_PATH_H__
#include "libfmqtglobals.h"
#include <libfm/fm.h>
#include <QString>
#include <QObject>
#include <QtGlobal>
#include <QMetaType>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API Path {
class LIBFM_QT_API PathList {
public:
Path(): data_(nullptr) {
PathList(void ) {
dataPtr_ = reinterpret_cast<FmPathList*>(fm_path_list_new());
}
Path(FmPath* path, bool takeOwnership = false): data_(path) {
if(path && !takeOwnership)
fm_path_ref(data_);
PathList(FmPathList* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmPathList*>(fm_list_ref(FM_LIST(dataPtr))) : nullptr;
}
Path(const Path& other): data_(other.data_ ? fm_path_ref(other.data_) : nullptr) {
// copy constructor
PathList(const PathList& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmPathList*>(fm_list_ref(FM_LIST(other.dataPtr_))) : nullptr;
}
Path(GFile* gf): data_(fm_path_new_for_gfile(gf)) {
// move constructor
PathList(PathList&& other) {
dataPtr_ = reinterpret_cast<FmPathList*>(other.takeDataPtr());
}
~Path() {
if(data_)
fm_path_unref(data_);
// destructor
~PathList() {
if(dataPtr_ != nullptr) {
fm_list_unref(FM_LIST(dataPtr_));
}
}
static Path fromPathName(const char* path_name) {
return Path(fm_path_new_for_path(path_name), true);
// create a wrapper for the data pointer without increasing the reference count
static PathList wrapPtr(FmPathList* dataPtr) {
PathList obj;
obj.dataPtr_ = reinterpret_cast<FmPathList*>(dataPtr);
return obj;
}
static Path fromUri(const char* uri) {
return Path(fm_path_new_for_uri(uri), true);
// disown the managed data pointer
FmPathList* takeDataPtr() {
FmPathList* data = reinterpret_cast<FmPathList*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
static Path fromDisplayName(const char* path_name) {
return Path(fm_path_new_for_display_name(path_name), true);
// get the raw pointer wrapped
FmPathList* dataPtr() {
return reinterpret_cast<FmPathList*>(dataPtr_);
}
static Path fromString(const char* path_str) {
return Path(fm_path_new_for_str(path_str), true);
// automatic type casting
operator FmPathList*() {
return dataPtr();
}
static Path fromCommandlineArg(const char* arg) {
return Path(fm_path_new_for_commandline_arg(arg), true);
// copy assignment
PathList& operator=(const PathList& other) {
if(dataPtr_ != nullptr) {
fm_list_unref(FM_LIST(dataPtr_));
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmPathList*>(fm_list_ref(FM_LIST(other.dataPtr_))) : nullptr;
return *this;
}
Path child(const char* basename) {
return Path(fm_path_new_child(data_, basename), true);
// move assignment
PathList& operator=(PathList&& other) {
dataPtr_ = reinterpret_cast<FmPathList*>(other.takeDataPtr());
return *this;
}
Path child(const char* basename, int name_len) {
return Path(fm_path_new_child_len(data_, basename, name_len), true);
bool isNull() {
return (dataPtr_ == nullptr);
}
Path relative(const char* rel) {
return Path(fm_path_new_relative(data_, rel), true);
// methods
void writeUriList(GString* buf) {
fm_path_list_write_uri_list(dataPtr(), buf);
}
/* predefined paths */
static Path root(void) { /* / */
return Path(fm_path_get_root(), false);
char* toUriList(void) {
return fm_path_list_to_uri_list(dataPtr());
}
static Path home(void) { /* home directory */
return Path(fm_path_get_home(), false);
unsigned int getLength() {
return fm_path_list_get_length(dataPtr());
}
static Path desktop(void) { /* $HOME/Desktop */
return Path(fm_path_get_desktop(), false);
bool isEmpty() {
return fm_path_list_is_empty(dataPtr());
}
static Path trash(void) { /* trash:/// */
return Path(fm_path_get_trash(), false);
FmPath* peekHead() {
return fm_path_list_peek_head(dataPtr());
}
static Path appsMenu(void) { /* menu://applications.menu/ */
return Path(fm_path_get_apps_menu(), false);
GList* peekHeadLink() {
return fm_path_list_peek_head_link(dataPtr());
}
Path parent() {
return Path(data_ != nullptr ? fm_path_get_parent(data_) : nullptr, false);
void pushTail(FmPath* path) {
fm_path_list_push_tail(dataPtr(), path);
}
const char* basename() {
return fm_path_get_basename(data_);
static PathList newFromFileInfoGslist(GSList* fis) {
return PathList::wrapPtr(fm_path_list_new_from_file_info_gslist(fis));
}
FmPathFlags flags() {
return fm_path_get_flags(data_);
static PathList newFromFileInfoGlist(GList* fis) {
return PathList::wrapPtr(fm_path_list_new_from_file_info_glist(fis));
}
bool hasPrefix(FmPath* prefix) {
return fm_path_has_prefix(data_, prefix);
static PathList newFromFileInfoList(FmFileInfoList* fis) {
return PathList::wrapPtr(fm_path_list_new_from_file_info_list(fis));
}
Path schemePath() {
return Path(fm_path_get_scheme_path(data_), true);
static PathList newFromUris(char* const* uris) {
return PathList::wrapPtr(fm_path_list_new_from_uris(uris));
}
static PathList newFromUriList(const char* uri_list) {
return PathList::wrapPtr(fm_path_list_new_from_uri_list(uri_list));
}
private:
FmPathList* dataPtr_; // data pointer for the underlying C struct
};
class LIBFM_QT_API Path {
public:
// default constructor
Path() {
dataPtr_ = nullptr;
}
Path(FmPath* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmPath*>(fm_path_ref(dataPtr)) : nullptr;
}
// copy constructor
Path(const Path& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmPath*>(fm_path_ref(other.dataPtr_)) : nullptr;
}
// move constructor
Path(Path&& other) {
dataPtr_ = reinterpret_cast<FmPath*>(other.takeDataPtr());
}
// destructor
~Path() {
if(dataPtr_ != nullptr) {
fm_path_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static Path wrapPtr(FmPath* dataPtr) {
Path obj;
obj.dataPtr_ = reinterpret_cast<FmPath*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmPath* takeDataPtr() {
FmPath* data = reinterpret_cast<FmPath*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmPath* dataPtr() {
return reinterpret_cast<FmPath*>(dataPtr_);
}
// automatic type casting
operator FmPath*() {
return dataPtr();
}
// copy assignment
Path& operator=(const Path& other) {
if(dataPtr_ != nullptr) {
fm_path_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmPath*>(fm_path_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
Path& operator=(Path&& other) {
dataPtr_ = reinterpret_cast<FmPath*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
bool isNative() {
return fm_path_is_native(data_);
return fm_path_is_native(dataPtr());
}
bool isTrash() {
return fm_path_is_trash(data_);
return fm_path_is_trash(dataPtr());
}
bool isTrashRoot() {
return fm_path_is_trash_root(data_);
return fm_path_is_trash_root(dataPtr());
}
bool isNativeOrTrash() {
return fm_path_is_native_or_trash(data_);
return fm_path_is_native_or_trash(dataPtr());
}
char* toString() {
return fm_path_to_str(data_);
int depth(void) {
return fm_path_depth(dataPtr());
}
QByteArray toByteArray() {
char* s = fm_path_to_str(data_);
QByteArray str(s);
g_free(s);
return str;
bool equalStr(const gchar* str, int n) {
return fm_path_equal_str(dataPtr(), str, n);
}
char* toUri() {
return fm_path_to_uri(data_);
int compare(FmPath* p2) {
return fm_path_compare(dataPtr(), p2);
}
GFile* toGfile() {
return fm_path_to_gfile(data_);
int compare(Path& p2) {
return fm_path_compare(dataPtr(), p2.dataPtr());
}
/*
char* displayName(bool human_readable = true) {
return fm_path_display_name(data_, human_readable);
bool equal(FmPath* p2) {
return fm_path_equal(dataPtr(), p2);
}
*/
QString displayName(bool human_readable = true) {
char* dispname = fm_path_display_name(data_, human_readable);
QString str = QString::fromUtf8(dispname);
g_free(dispname);
return str;
bool equal(Path& p2) {
return fm_path_equal(dataPtr(), p2.dataPtr());
}
/*
char* displayBasename() {
return fm_path_display_basename(data_);
bool operator == (Path& other) {
return fm_path_equal(dataPtr(), other.dataPtr());
}
*/
QString displayBasename() {
char* basename = fm_path_display_basename(data_);
QString s = QString::fromUtf8(basename);
g_free(basename);
return s;
bool operator != (Path& other) {
return !fm_path_equal(dataPtr(), other.dataPtr());
}
/* For used in hash tables */
guint hash() {
return fm_path_hash(data_);
bool operator < (Path& other) {
return compare(other);
}
void take(FmPath* path) { // take the ownership of the "path"
if(data_)
fm_path_unref(data_);
data_ = path;
bool operator > (Path& other) {
return (other < *this);
}
Path& operator = (const Path& other) {
if(data_)
fm_path_unref(data_);
data_ = fm_path_ref(other.data_);
return *this;
unsigned int hash(void) {
return fm_path_hash(dataPtr());
}
bool operator == (const Path& other) const {
return fm_path_equal(data_, other.data_);
char* displayBasename(void) {
return fm_path_display_basename(dataPtr());
}
bool operator != (const Path& other) const {
return !fm_path_equal(data_, other.data_);
char* displayName(gboolean human_readable) {
return fm_path_display_name(dataPtr(), human_readable);
}
bool operator < (const Path& other) const {
return compare(other);
GFile* toGfile(void) {
return fm_path_to_gfile(dataPtr());
}
bool operator > (const Path& other) const {
return (other < *this);
char* toUri(void) {
return fm_path_to_uri(dataPtr());
}
char* toStr(void) {
return fm_path_to_str(dataPtr());
}
Path getSchemePath(void) {
return Path(fm_path_get_scheme_path(dataPtr()));
}
bool hasPrefix(FmPath* prefix) {
return fm_path_has_prefix(dataPtr(), prefix);
}
FmPathFlags getFlags(void) {
return fm_path_get_flags(dataPtr());
}
Path getParent(void) {
return Path(fm_path_get_parent(dataPtr()));
}
static Path getAppsMenu(void ) {
return Path(fm_path_get_apps_menu());
}
/* can be used for sorting */
int compare(const Path& other) const {
return fm_path_compare(data_, other.data_);
static Path getTrash(void ) {
return Path(fm_path_get_trash());
}
static Path getDesktop(void ) {
return Path(fm_path_get_desktop());
}
static Path getHome(void ) {
return Path(fm_path_get_home());
}
static Path getRoot(void ) {
return Path(fm_path_get_root());
}
static Path newForGfile(GFile* gf) {
return Path::wrapPtr(fm_path_new_for_gfile(gf));
}
Path newRelative(const char* rel) {
return Path::wrapPtr(fm_path_new_relative(dataPtr(), rel));
}
Path newChildLen(const char* basename, int name_len) {
return Path::wrapPtr(fm_path_new_child_len(dataPtr(), basename, name_len));
}
/* used for completion in entry */
bool equal(const gchar *str, int n) const {
return fm_path_equal_str(data_, str, n);
Path newChild(const char* basename) {
return Path::wrapPtr(fm_path_new_child(dataPtr(), basename));
}
/* calculate how many elements are in this path. */
int depth() const {
return fm_path_depth(data_);
static Path newForCommandlineArg(const char* arg) {
return Path::wrapPtr(fm_path_new_for_commandline_arg(arg));
}
FmPath* data() const {
return data_;
static Path newForStr(const char* path_str) {
return Path::wrapPtr(fm_path_new_for_str(path_str));
}
static Path newForDisplayName(const char* path_name) {
return Path::wrapPtr(fm_path_new_for_display_name(path_name));
}
static Path newForUri(const char* uri) {
return Path::wrapPtr(fm_path_new_for_uri(uri));
}
static Path newForPath(const char* path_name) {
return Path::wrapPtr(fm_path_new_for_path(path_name));
}
private:
FmPath* data_;
FmPath* dataPtr_; // data pointer for the underlying C struct
};
}
Q_DECLARE_OPAQUE_POINTER(FmPath*)
#endif // FM_PATH_H
#endif // __LIBFM_QT_FM_PATH_H__

@ -69,9 +69,9 @@ void PathEditJob::runJob() {
PathEdit::PathEdit(QWidget* parent):
QLineEdit(parent),
cancellable_(NULL),
completer_(new QCompleter()),
model_(new QStringListModel()),
completer_(new QCompleter()) {
cancellable_(NULL) {
setCompleter(completer_);
completer_->setModel(model_);
connect(this, &PathEdit::textChanged, this, &PathEdit::onTextChanged);

@ -27,15 +27,15 @@ namespace Fm {
PlacesModelItem::PlacesModelItem():
QStandardItem(),
path_(NULL),
icon_(NULL),
fileInfo_(NULL) {
fileInfo_(NULL),
icon_(NULL) {
}
PlacesModelItem::PlacesModelItem(const char* iconName, QString title, FmPath* path):
QStandardItem(title),
path_(path ? fm_path_ref(path) : NULL),
icon_(fm_icon_from_name(iconName)),
fileInfo_(NULL) {
fileInfo_(NULL),
icon_(fm_icon_from_name(iconName)) {
if(icon_)
QStandardItem::setIcon(IconTheme::icon(icon_));
setEditable(false);
@ -44,8 +44,8 @@ PlacesModelItem::PlacesModelItem(const char* iconName, QString title, FmPath* pa
PlacesModelItem::PlacesModelItem(FmIcon* icon, QString title, FmPath* path):
QStandardItem(title),
path_(path ? fm_path_ref(path) : NULL),
icon_(icon ? fm_icon_ref(icon) : NULL),
fileInfo_(NULL) {
fileInfo_(NULL),
icon_(icon ? fm_icon_ref(icon) : NULL) {
if(icon_)
QStandardItem::setIcon(IconTheme::icon(icon));
setEditable(false);
@ -53,9 +53,9 @@ PlacesModelItem::PlacesModelItem(FmIcon* icon, QString title, FmPath* path):
PlacesModelItem::PlacesModelItem(QIcon icon, QString title, FmPath* path):
QStandardItem(icon, title),
icon_(NULL),
path_(path ? fm_path_ref(path) : NULL),
fileInfo_(NULL) {
fileInfo_(NULL),
icon_(NULL) {
setEditable(false);
}

@ -26,10 +26,10 @@ namespace Fm {
ProxyFolderModel::ProxyFolderModel(QObject * parent):
QSortFilterProxyModel(parent),
thumbnailSize_(0),
showHidden_(false),
folderFirst_(true),
showThumbnails_(false),
folderFirst_(true) {
thumbnailSize_(0) {
setDynamicSortFilter(true);
setSortCaseSensitivity(Qt::CaseInsensitive);
}

@ -72,9 +72,9 @@ RenameDialog::RenameDialog(FmFileInfo* src, FmFileInfo* dest, QWidget* parent, Q
.arg(QString::fromUtf8(fm_file_info_get_disp_mtime(dest)));
}
else {
infoStr = QString(tr("Type: %1\nModified: %3"))
.arg(QString::fromUtf8(fm_file_info_get_desc(src)))
.arg(QString::fromUtf8(fm_file_info_get_disp_mtime(src)));
infoStr = QString(tr("Type: %1\nModified: %2"))
.arg(QString::fromUtf8(fm_file_info_get_desc(dest)))
.arg(QString::fromUtf8(fm_file_info_get_disp_mtime(dest)));
}
ui->destInfo->setText(infoStr);

@ -32,12 +32,12 @@ namespace Fm {
SidePane::SidePane(QWidget* parent):
QWidget(parent),
showHidden_(false),
mode_(ModeNone),
currentPath_(NULL),
view_(NULL),
combo_(NULL),
currentPath_(NULL),
iconSize_(24, 24) {
iconSize_(24, 24),
mode_(ModeNone),
showHidden_(false) {
verticalLayout = new QVBoxLayout(this);
verticalLayout->setContentsMargins(0, 0, 0, 0);

@ -0,0 +1,158 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_TEMPLATES_H__
#define __LIBFM_QT_FM_TEMPLATES_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API Template {
public:
// default constructor
Template() {
dataPtr_ = nullptr;
}
Template(FmTemplate* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
Template(const Template& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
Template(Template&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// destructor
virtual ~Template() {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static Template wrapPtr(FmTemplate* dataPtr) {
Template obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmTemplate* takeDataPtr() {
FmTemplate* data = reinterpret_cast<FmTemplate*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmTemplate* dataPtr() {
return reinterpret_cast<FmTemplate*>(dataPtr_);
}
// automatic type casting
operator FmTemplate*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
Template& operator=(const Template& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
Template& operator=(Template&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
bool createFile(GFile* path, GError** error, gboolean run_default) {
return fm_template_create_file(dataPtr(), path, error, run_default);
}
bool isDirectory(void) {
return fm_template_is_directory(dataPtr());
}
FmIcon* getIcon(void) {
return fm_template_get_icon(dataPtr());
}
FmMimeType* getMimeType(void) {
return fm_template_get_mime_type(dataPtr());
}
static GList* listAll(gboolean user_only) {
return fm_template_list_all(user_only);
}
// automatic type casting for GObject
operator GObject*() {
return reinterpret_cast<GObject*>(dataPtr_);
}
protected:
GObject* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_TEMPLATES_H__

@ -0,0 +1,143 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_TERMINAL_H__
#define __LIBFM_QT_FM_TERMINAL_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API Terminal {
public:
// default constructor
Terminal() {
dataPtr_ = nullptr;
}
Terminal(FmTerminal* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
}
// copy constructor
Terminal(const Terminal& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
}
// move constructor
Terminal(Terminal&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
}
// destructor
virtual ~Terminal() {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static Terminal wrapPtr(FmTerminal* dataPtr) {
Terminal obj;
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmTerminal* takeDataPtr() {
FmTerminal* data = reinterpret_cast<FmTerminal*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmTerminal* dataPtr() {
return reinterpret_cast<FmTerminal*>(dataPtr_);
}
// automatic type casting
operator FmTerminal*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
Terminal& operator=(const Terminal& other) {
if(dataPtr_ != nullptr) {
g_object_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
Terminal& operator=(Terminal&& other) {
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
static bool launch(const gchar* dir, GError** error) {
return fm_terminal_launch(dir, error);
}
static Terminal dupDefault(GError** error) {
return Terminal::wrapPtr(fm_terminal_dup_default(error));
}
// automatic type casting for GObject
operator GObject*() {
return reinterpret_cast<GObject*>(dataPtr_);
}
protected:
GObject* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_TERMINAL_H__

@ -0,0 +1,158 @@
/*
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LIBFM_QT_FM_THUMBNAILER_H__
#define __LIBFM_QT_FM_THUMBNAILER_H__
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
class LIBFM_QT_API Thumbnailer {
public:
// default constructor
Thumbnailer() {
dataPtr_ = nullptr;
}
Thumbnailer(FmThumbnailer* dataPtr){
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmThumbnailer*>(fm_thumbnailer_ref(dataPtr)) : nullptr;
}
// copy constructor
Thumbnailer(const Thumbnailer& other) {
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmThumbnailer*>(fm_thumbnailer_ref(other.dataPtr_)) : nullptr;
}
// move constructor
Thumbnailer(Thumbnailer&& other) {
dataPtr_ = reinterpret_cast<FmThumbnailer*>(other.takeDataPtr());
}
// destructor
~Thumbnailer() {
if(dataPtr_ != nullptr) {
fm_thumbnailer_unref(dataPtr_);
}
}
// create a wrapper for the data pointer without increasing the reference count
static Thumbnailer wrapPtr(FmThumbnailer* dataPtr) {
Thumbnailer obj;
obj.dataPtr_ = reinterpret_cast<FmThumbnailer*>(dataPtr);
return obj;
}
// disown the managed data pointer
FmThumbnailer* takeDataPtr() {
FmThumbnailer* data = reinterpret_cast<FmThumbnailer*>(dataPtr_);
dataPtr_ = nullptr;
return data;
}
// get the raw pointer wrapped
FmThumbnailer* dataPtr() {
return reinterpret_cast<FmThumbnailer*>(dataPtr_);
}
// automatic type casting
operator FmThumbnailer*() {
return dataPtr();
}
// automatic type casting
operator void*() {
return dataPtr();
}
// copy assignment
Thumbnailer& operator=(const Thumbnailer& other) {
if(dataPtr_ != nullptr) {
fm_thumbnailer_unref(dataPtr_);
}
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmThumbnailer*>(fm_thumbnailer_ref(other.dataPtr_)) : nullptr;
return *this;
}
// move assignment
Thumbnailer& operator=(Thumbnailer&& other) {
dataPtr_ = reinterpret_cast<FmThumbnailer*>(other.takeDataPtr());
return *this;
}
bool isNull() {
return (dataPtr_ == nullptr);
}
// methods
static void checkUpdate( ) {
fm_thumbnailer_check_update();
}
void free(void) {
fm_thumbnailer_free(dataPtr());
}
bool launchForUri(const char* uri, const char* output_file, guint size) {
return fm_thumbnailer_launch_for_uri(dataPtr(), uri, output_file, size);
}
GPid launchForUriAsync(const char* uri, const char* output_file, guint size, GError** error) {
return fm_thumbnailer_launch_for_uri_async(dataPtr(), uri, output_file, size, error);
}
char* commandForUri(const char* uri, const char* output_file, guint size) {
return fm_thumbnailer_command_for_uri(dataPtr(), uri, output_file, size);
}
static Thumbnailer newFromKeyfile(const char* id, GKeyFile* kf) {
return Thumbnailer::wrapPtr(fm_thumbnailer_new_from_keyfile(id, kf));
}
private:
FmThumbnailer* dataPtr_; // data pointer for the underlying C struct
};
}
#endif // __LIBFM_QT_FM_THUMBNAILER_H__

@ -98,7 +98,7 @@ ThumbnailLoader::ThumbnailLoader() {
getImageText,
setImageText
};
gboolean success = fm_thumbnail_loader_set_backend(&qt_backend);
fm_thumbnail_loader_set_backend(&qt_backend);
}
ThumbnailLoader::~ThumbnailLoader() {
@ -117,7 +117,7 @@ GObject* ThumbnailLoader::readImageFromStream(GInputStream* stream, guint64 len,
// FIXME: should we set a limit here? Otherwise if len is too large, we can run out of memory.
QScopedArrayPointer<unsigned char> buffer(new unsigned char[len]); // allocate enough buffer
unsigned char* pbuffer = buffer.data();
int totalReadSize = 0;
unsigned int totalReadSize = 0;
while(!g_cancellable_is_cancelled(cancellable) && totalReadSize < len) {
int bytesToRead = totalReadSize + 4096 > len ? len - totalReadSize : 4096;
gssize readSize = g_input_stream_read(stream, pbuffer, bytesToRead, cancellable, NULL);

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

@ -93,7 +93,7 @@ void copyFilesToClipboard(FmPathList* files) {
QMimeData* data = new QMimeData();
char* urilist = fm_path_list_to_uri_list(files);
// Gnome, LXDE, and XFCE
data->setData("x-special/gnome-copied-files", (QString("copy\n") + urilist).toUtf8());
data->setData("x-special/gnome-copied-files", QByteArray("copy\n") + QByteArray(urilist));
// The KDE way
data->setData("text/uri-list", urilist);
// data.setData("x-kde-cut-selection", "0");
@ -106,7 +106,7 @@ void cutFilesToClipboard(FmPathList* files) {
QMimeData* data = new QMimeData();
char* urilist = fm_path_list_to_uri_list(files);
// Gnome, LXDE, and XFCE
data->setData("x-special/gnome-copied-files", (QString("cut\n") + urilist).toUtf8());
data->setData("x-special/gnome-copied-files", QByteArray("cut\n") + QByteArray(urilist));
// The KDE way
data->setData("text/uri-list", urilist);
data->setData("x-kde-cut-selection", "1");

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013 - 2015 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -17,6 +17,19 @@
*
*/
#include "path.h"
#ifndef __LIBFM_QT_FM_UTILS_H__
#define __LIBFM_QT_FM_UTILS_H__
using namespace Fm;
#include <libfm/fm.h>
#include <QObject>
#include <QtGlobal>
#include "libfmqtglobals.h"
namespace Fm {
}
#endif // __LIBFM_QT_FM_UTILS_H__

@ -84,7 +84,6 @@ XdndWorkaround::~XdndWorkaround() {
bool XdndWorkaround::nativeEventFilter(const QByteArray & eventType, void * message, long * result) {
if(Q_LIKELY(eventType == "xcb_generic_event_t")) {
xcb_generic_event_t* event = static_cast<xcb_generic_event_t *>(message);
uint8_t response_type = event->response_type & uint8_t(~0x80);
switch(event->response_type & ~0x80) {
case XCB_CLIENT_MESSAGE:
return clientMessage(reinterpret_cast<xcb_client_message_event_t*>(event));
@ -163,12 +162,11 @@ QByteArray XdndWorkaround::windowProperty(xcb_window_t window, xcb_atom_t propAt
// static
void XdndWorkaround::setWindowProperty(xcb_window_t window, xcb_atom_t propAtom, xcb_atom_t typeAtom, void* data, int len, int format) {
xcb_connection_t* conn = QX11Info::connection();
xcb_void_cookie_t cookie = xcb_change_property(conn, XCB_PROP_MODE_REPLACE, window, propAtom, typeAtom, format, len, data);
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, window, propAtom, typeAtom, format, len, data);
}
bool XdndWorkaround::clientMessage(xcb_client_message_event_t* event) {
xcb_connection_t* conn = QX11Info::connection();
QByteArray event_type = atomName(event->type);
// qDebug() << "client message:" << event_type;

Loading…
Cancel
Save