Imported Upstream version 0.11.0

ubuntu/cosmic upstream/0.11.0
ChangZhuo Chen (陳昌倬) 9 years ago
parent 2d86a13669
commit 25794f3459

9
.gitignore vendored

@ -0,0 +1,9 @@
build*/
# Vim.gitignore
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~

@ -4,7 +4,7 @@ project(libfm-qt)
set(LIBFM_QT_LIBRARY_NAME "fm-qt" CACHE STRING "fm-qt")
set(LIBFM_QT_VERSION_MAJOR 0)
set(LIBFM_QT_VERSION_MINOR 10)
set(LIBFM_QT_VERSION_MINOR 11)
set(LIBFM_QT_VERSION_PATCH 0)
set(LIBFM_QT_VERSION ${LIBFM_QT_VERSION_MAJOR}.${LIBFM_QT_VERSION_MINOR}.${LIBFM_QT_VERSION_PATCH})
@ -17,9 +17,9 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Actually, libtool uses different ways on different operating systems. So there is no
# universal way to translate a libtool version-info to a cmake version.
# We use "(current-age).age.revision" as the cmake version.
# current: 2, revision: 0, age: 0 => version: 2.0.0
set(LIBFM_QT_LIB_VERSION "2.0.0")
set(LIBFM_QT_LIB_SOVERSION "2")
# current: 3, revision: 0, age: 0 => version: 3.0.0
set(LIBFM_QT_LIB_VERSION "3.0.0")
set(LIBFM_QT_LIB_SOVERSION "3")
set(REQUIRED_QT_VERSION "5.2")
set(REQUIRED_LIBFM_VERSION "1.2.0")

@ -0,0 +1,49 @@
/*
* Copyright (C) 2012 - 2015 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 FM_CUSTOMACTION_P_H
#define FM_CUSTOMACTION_P_H
namespace Fm {
class CustomAction : public QAction {
public:
explicit CustomAction(FmFileActionItem* item, QObject* parent = NULL):
QAction(QString::fromUtf8(fm_file_action_item_get_name(item)), parent),
item_(reinterpret_cast<FmFileActionItem*>(fm_file_action_item_ref(item))) {
const char* icon_name = fm_file_action_item_get_icon(item);
if(icon_name)
setIcon(QIcon::fromTheme(icon_name));
}
virtual ~CustomAction() {
fm_file_action_item_unref(item_);
}
FmFileActionItem* item() {
return item_;
}
private:
FmFileActionItem* item_;
};
} // namespace Fm
#endif

@ -28,6 +28,7 @@
#include "appchooserdialog.h"
#ifdef CUSTOM_ACTIONS
#include <libfm/fm-actions.h>
#include "customaction_p.h"
#endif
#include <QMessageBox>
#include <QDebug>
@ -184,6 +185,11 @@ void FileMenu::createMenu(FmFileInfoList* files, FmFileInfo* info, FmPath* cwd)
GList* l;
for(l=items; l; l=l->next) {
FmFileActionItem* item = FM_FILE_ACTION_ITEM(l->data);
if(l == items && item
&& !(fm_file_action_item_is_action(item)
&& !(fm_file_action_item_get_target(item) & FM_FILE_ACTION_TARGET_CONTEXT))) {
addSeparator(); // before all custom actions
}
addCustomActionItem(this, item);
}
}

@ -21,9 +21,6 @@
#define FM_FILEMENU_P_H
#include "icontheme.h"
#ifdef CUSTOM_ACTIONS
#include <libfm/fm-actions.h>
#endif
#include <QDebug>
namespace Fm {
@ -53,32 +50,6 @@ private:
GAppInfo* appInfo_;
};
#ifdef CUSTOM_ACTIONS
class CustomAction : public QAction {
Q_OBJECT
public:
explicit CustomAction(FmFileActionItem* item, QObject* parent = NULL):
QAction(QString::fromUtf8(fm_file_action_item_get_name(item)), parent),
item_(reinterpret_cast<FmFileActionItem*>(fm_file_action_item_ref(item))) {
const char* icon_name = fm_file_action_item_get_icon(item);
if(icon_name)
setIcon(QIcon::fromTheme(icon_name));
}
virtual ~CustomAction() {
fm_file_action_item_unref(item_);
}
FmFileActionItem* item() {
return item_;
}
private:
FmFileActionItem* item_;
};
#endif
} // namespace Fm
#endif

@ -261,22 +261,36 @@
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="largerThan">
<property name="text">
<string>Larger than:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QCheckBox" name="smallerThan">
<property name="text">
<string>Smaller than:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="maxSize">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QSpinBox" name="minSize">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<item row="0" column="0">
<widget class="QCheckBox" name="largerThan">
<property name="text">
<string>Larger than:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="minSizeUnit">
<property name="enabled">
<bool>false</bool>
@ -306,25 +320,7 @@
</item>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="smallerThan">
<property name="text">
<string>Smaller than:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSpinBox" name="maxSize">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<item row="1" column="3">
<widget class="QComboBox" name="maxSizeUnit">
<property name="enabled">
<bool>false</bool>
@ -361,43 +357,50 @@
</item>
<item>
<widget class="QGroupBox" name="groupBox_6">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="title">
<string>Last Modified Time:</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="earlierThan">
<property name="text">
<string>Earlier than:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="laterThan">
<property name="text">
<string>Later than:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDateEdit" name="maxTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDateEdit" name="minTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QCheckBox" name="earlierThan">
<property name="text">
<string>Earlier than:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="laterThan">
<property name="text">
<string>Later than:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDateEdit" name="minTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDateEdit" name="maxTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>

@ -41,6 +41,8 @@ FileSearchDialog::FileSearchDialog(QStringList paths, QWidget* parent, Qt::Windo
connect(ui->addPath, &QPushButton::clicked, this, &FileSearchDialog::onAddPath);
connect(ui->removePath, &QPushButton::clicked, this, &FileSearchDialog::onRemovePath);
ui->namePatterns->setFocus();
}
FileSearchDialog::~FileSearchDialog() {

@ -25,6 +25,10 @@
#include "folderview.h"
#include "utilities.h"
#include <cstring> // for memset
#ifdef CUSTOM_ACTIONS
#include "customaction_p.h"
#include <QMessageBox>
#endif
namespace Fm {
@ -68,6 +72,29 @@ FolderMenu::FolderMenu(FolderView* view, QWidget* parent):
showHiddenAction_->setChecked(model->showHidden());
connect(showHiddenAction_, &QAction::triggered, this, &FolderMenu::onShowHiddenActionTriggered);
#ifdef CUSTOM_ACTIONS
FmFileInfo* folderInfo = view_->folderInfo();
if(folderInfo) {
GList *single_list = NULL;
single_list = g_list_prepend(single_list, (GList*)folderInfo);
GList* items = fm_get_actions_for_files(single_list);
if(items) {
GList* l;
for(l=items; l; l=l->next) {
FmFileActionItem* item = FM_FILE_ACTION_ITEM(l->data);
if(l == items && item
&& !(fm_file_action_item_is_action(item)
&& !(fm_file_action_item_get_target(item) & FM_FILE_ACTION_TARGET_CONTEXT))) {
addSeparator(); // before all custom actions
}
addCustomActionItem(this, item);
}
}
g_list_foreach(items, (GFunc)fm_file_action_item_unref, NULL);
g_list_free(items);
}
#endif
separator4_ = addSeparator();
propertiesAction_ = new QAction(tr("Folder Pr&operties"), this);
@ -78,6 +105,46 @@ FolderMenu::FolderMenu(FolderView* view, QWidget* parent):
FolderMenu::~FolderMenu() {
}
#ifdef CUSTOM_ACTIONS
void FolderMenu::addCustomActionItem(QMenu* menu, FmFileActionItem* item) {
if(!item) return;
if(fm_file_action_item_is_action(item) && !(fm_file_action_item_get_target(item) & FM_FILE_ACTION_TARGET_CONTEXT))
return;
CustomAction* action = new CustomAction(item, menu);
menu->addAction(action);
if(fm_file_action_item_is_menu(item)) {
GList* subitems = fm_file_action_item_get_sub_items(item);
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);
}
}
else if(fm_file_action_item_is_action(item)) {
connect(action, &QAction::triggered, this, &FolderMenu::onCustomActionTrigerred);
}
}
void FolderMenu::onCustomActionTrigerred() {
CustomAction* action = static_cast<CustomAction*>(sender());
FmFileActionItem* item = action->item();
FmFileInfo* folderInfo = view_->folderInfo();
if(folderInfo) {
GList *single_list = NULL;
single_list = g_list_prepend(single_list, (GList*)folderInfo);
char* output = NULL;
fm_file_action_item_launch(item, NULL, single_list, &output);
if(output) {
QMessageBox::information(this, tr("Output"), QString::fromUtf8(output));
g_free(output);
}
}
}
#endif
void FolderMenu::addSortMenuItem(QString title, int id) {
QAction* action = new QAction(title, this);
sortMenu_->addAction(action);

@ -25,6 +25,9 @@
#include <QMenu>
#include <libfm/fm.h>
#include "foldermodel.h"
#ifdef CUSTOM_ACTIONS
#include <libfm/fm-actions.h>
#endif
class QAction;
@ -87,6 +90,11 @@ public:
return view_;
}
protected:
#ifdef CUSTOM_ACTIONS
void addCustomActionItem(QMenu* menu, FmFileActionItem* item);
#endif
protected Q_SLOTS:
void onPasteActionTriggered();
void onSelectAllActionTriggered();
@ -97,6 +105,9 @@ protected Q_SLOTS:
void onCaseSensitiveActionTriggered(bool checked);
void onFolderFirstActionTriggered(bool checked);
void onPropertiesActionTriggered();
#ifdef CUSTOM_ACTIONS
void onCustomActionTrigerred();
#endif
private:
void createSortMenu();

@ -473,6 +473,7 @@ void FolderView::setViewMode(ViewMode _mode) {
if(mode == DetailedListMode) {
FolderViewTreeView* treeView = new FolderViewTreeView(this);
connect(treeView, &FolderViewTreeView::activatedFiltered, this, &FolderView::onItemActivated);
setFocusProxy(treeView);
view = treeView;
treeView->setItemsExpandable(false);
@ -492,6 +493,8 @@ void FolderView::setViewMode(ViewMode _mode) {
connect(listView, &FolderViewListView::activatedFiltered, this, &FolderView::onItemActivated);
view = listView;
}
setFocusProxy(listView);
// set our own custom delegate
FolderItemDelegate* delegate = new FolderItemDelegate(listView);
listView->setItemDelegateForColumn(FolderModel::ColumnFileName, delegate);

Loading…
Cancel
Save