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_LIBRARY_NAME "fm-qt" CACHE STRING "fm-qt")
set(LIBFM_QT_VERSION_MAJOR 0) 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_PATCH 0)
set(LIBFM_QT_VERSION ${LIBFM_QT_VERSION_MAJOR}.${LIBFM_QT_VERSION_MINOR}.${LIBFM_QT_VERSION_PATCH}) 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 # 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. # universal way to translate a libtool version-info to a cmake version.
# We use "(current-age).age.revision" as the cmake version. # We use "(current-age).age.revision" as the cmake version.
# current: 2, revision: 0, age: 0 => version: 2.0.0 # current: 3, revision: 0, age: 0 => version: 3.0.0
set(LIBFM_QT_LIB_VERSION "2.0.0") set(LIBFM_QT_LIB_VERSION "3.0.0")
set(LIBFM_QT_LIB_SOVERSION "2") set(LIBFM_QT_LIB_SOVERSION "3")
set(REQUIRED_QT_VERSION "5.2") set(REQUIRED_QT_VERSION "5.2")
set(REQUIRED_LIBFM_VERSION "1.2.0") 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" #include "appchooserdialog.h"
#ifdef CUSTOM_ACTIONS #ifdef CUSTOM_ACTIONS
#include <libfm/fm-actions.h> #include <libfm/fm-actions.h>
#include "customaction_p.h"
#endif #endif
#include <QMessageBox> #include <QMessageBox>
#include <QDebug> #include <QDebug>
@ -184,6 +185,11 @@ void FileMenu::createMenu(FmFileInfoList* files, FmFileInfo* info, FmPath* cwd)
GList* l; GList* l;
for(l=items; l; l=l->next) { for(l=items; l; l=l->next) {
FmFileActionItem* item = FM_FILE_ACTION_ITEM(l->data); 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); addCustomActionItem(this, item);
} }
} }

@ -21,9 +21,6 @@
#define FM_FILEMENU_P_H #define FM_FILEMENU_P_H
#include "icontheme.h" #include "icontheme.h"
#ifdef CUSTOM_ACTIONS
#include <libfm/fm-actions.h>
#endif
#include <QDebug> #include <QDebug>
namespace Fm { namespace Fm {
@ -53,32 +50,6 @@ private:
GAppInfo* appInfo_; 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 } // namespace Fm
#endif #endif

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

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

@ -25,6 +25,10 @@
#include "folderview.h" #include "folderview.h"
#include "utilities.h" #include "utilities.h"
#include <cstring> // for memset #include <cstring> // for memset
#ifdef CUSTOM_ACTIONS
#include "customaction_p.h"
#include <QMessageBox>
#endif
namespace Fm { namespace Fm {
@ -68,6 +72,29 @@ FolderMenu::FolderMenu(FolderView* view, QWidget* parent):
showHiddenAction_->setChecked(model->showHidden()); showHiddenAction_->setChecked(model->showHidden());
connect(showHiddenAction_, &QAction::triggered, this, &FolderMenu::onShowHiddenActionTriggered); 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(); separator4_ = addSeparator();
propertiesAction_ = new QAction(tr("Folder Pr&operties"), this); propertiesAction_ = new QAction(tr("Folder Pr&operties"), this);
@ -78,6 +105,46 @@ FolderMenu::FolderMenu(FolderView* view, QWidget* parent):
FolderMenu::~FolderMenu() { 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) { void FolderMenu::addSortMenuItem(QString title, int id) {
QAction* action = new QAction(title, this); QAction* action = new QAction(title, this);
sortMenu_->addAction(action); sortMenu_->addAction(action);

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

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

Loading…
Cancel
Save