* debian/experimental: Update gbp.conf Update Vcs-* fields Cherry-picking upstream version 0.10.0. Cherry-picking upstream version 0.9.0+20151031. Cherry-picking upstream version 0.9.0+20150929. Cherry-picking upstream version 0.9.0+20150927. Solves: - apply-button for desktop preferences - close the desktop painting process by incident Cherry-picked upstream version 0.9.0+20150925.ubuntu/cosmic debian/0.10.0-2
commit
356dcd1014
@ -0,0 +1,2 @@
|
||||
build
|
||||
*.kdev4
|
@ -1,11 +0,0 @@
|
||||
PCManFM-Qt is the Qt port of the LXDE file manager PCManFM.
|
||||
Libfm-Qt is a companion library providing components to build desktop file managers.
|
||||
|
||||
Issue tracker:
|
||||
https://github.com/lxde/pcmanfm-qt/issues
|
||||
|
||||
LXQt website:
|
||||
http://lxqt.org
|
||||
|
||||
LXDE website:
|
||||
http://lxde.org
|
@ -0,0 +1,15 @@
|
||||
# PCManFM-Qt
|
||||
|
||||
The Qt port of the LXDE file manager PCManFM.
|
||||
|
||||
Includes libfm-qt, the qt port of the libfm-qt - a library providing components
|
||||
to build desktop file managers.
|
||||
|
||||
Issue tracker:
|
||||
https://github.com/lxde/pcmanfm-qt/issues
|
||||
|
||||
LXQt website:
|
||||
http://lxqt.org
|
||||
|
||||
LXDE website:
|
||||
http://lxde.org
|
@ -1,2 +1,2 @@
|
||||
AUTHORS
|
||||
README
|
||||
README.md
|
||||
|
@ -1,2 +1,8 @@
|
||||
[DEFAULT]
|
||||
debian-branch = debian/sid
|
||||
upstream-branch = upstream/latest
|
||||
pristine-tar = True
|
||||
|
||||
[import-orig]
|
||||
# Use git cherrypick -n upstream instead.
|
||||
merge = False
|
||||
|
@ -0,0 +1,449 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SearchDialog</class>
|
||||
<widget class="QDialog" name="SearchDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>512</width>
|
||||
<height>420</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Search Files</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset theme="system-search">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Name/Location</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>File Name Patterns:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="namePatterns">
|
||||
<property name="text">
|
||||
<string>*</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="nameCaseInsensitive">
|
||||
<property name="text">
|
||||
<string>Case insensitive</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="nameRegExp">
|
||||
<property name="text">
|
||||
<string>Use regular expression</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Places to Search:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listView"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addPath">
|
||||
<property name="text">
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="list-add">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removePath">
|
||||
<property name="text">
|
||||
<string>&Remove</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="list-remove">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="recursiveSearch">
|
||||
<property name="text">
|
||||
<string>Search in sub directories</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="searchHidden">
|
||||
<property name="text">
|
||||
<string>Search for hidden files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>File Type</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Only search for files of following types:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="searchTextFiles">
|
||||
<property name="text">
|
||||
<string>Text files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="searchImages">
|
||||
<property name="text">
|
||||
<string>Image files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="searchAudio">
|
||||
<property name="text">
|
||||
<string>Audio files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="searchVideo">
|
||||
<property name="text">
|
||||
<string>Video files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="searchDocuments">
|
||||
<property name="text">
|
||||
<string>Documents</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="searchFolders">
|
||||
<property name="text">
|
||||
<string>Folders</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Content</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>File contains:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="contentPattern"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="contentCaseInsensitive">
|
||||
<property name="text">
|
||||
<string>Case insensiti&ve</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="contentRegExp">
|
||||
<property name="text">
|
||||
<string>&Use regular expression</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>186</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Properties</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>File Size:</string>
|
||||
</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>
|
||||
<widget class="QSpinBox" name="minSize"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="minSizeUnit">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Bytes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>KiB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MiB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>GiB</string>
|
||||
</property>
|
||||
</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"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="maxSizeUnit">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Bytes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>KiB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MiB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>GiB</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<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="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDateEdit" name="minTime">
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SearchDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SearchDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (C) 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "filesearchdialog.h"
|
||||
#include <QMessageBox>
|
||||
#include "fm-search.h"
|
||||
#include "ui_filesearch.h"
|
||||
#include <limits>
|
||||
#include <QFileDialog>
|
||||
|
||||
namespace Fm {
|
||||
|
||||
FileSearchDialog::FileSearchDialog(QStringList paths, QWidget* parent, Qt::WindowFlags f):
|
||||
QDialog(parent, f),
|
||||
ui(new Ui::SearchDialog()) {
|
||||
ui->setupUi(this);
|
||||
ui->minSize->setMaximum(std::numeric_limits<int>().max());
|
||||
ui->maxSize->setMaximum(std::numeric_limits<int>().max());
|
||||
Q_FOREACH(const QString& path, paths) {
|
||||
ui->listView->addItem(path);
|
||||
}
|
||||
|
||||
ui->maxTime->setDate(QDate::currentDate());
|
||||
ui->minTime->setDate(QDate::currentDate());
|
||||
|
||||
connect(ui->addPath, &QPushButton::clicked, this, &FileSearchDialog::onAddPath);
|
||||
connect(ui->removePath, &QPushButton::clicked, this, &FileSearchDialog::onRemovePath);
|
||||
}
|
||||
|
||||
FileSearchDialog::~FileSearchDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FileSearchDialog::accept() {
|
||||
// build the search:/// uri
|
||||
int n = ui->listView->count();
|
||||
if(n > 0) {
|
||||
FmSearch* search = fm_search_new();
|
||||
int i;
|
||||
for(i = 0; i < n; ++i) { // add directories
|
||||
QListWidgetItem* item = ui->listView->item(i);
|
||||
fm_search_add_dir(search, item->text().toLocal8Bit().constData());
|
||||
}
|
||||
|
||||
fm_search_set_recursive(search, ui->recursiveSearch->isChecked());
|
||||
fm_search_set_show_hidden(search, ui->searchHidden->isChecked());
|
||||
fm_search_set_name_patterns(search, ui->namePatterns->text().toUtf8().constData());
|
||||
fm_search_set_name_ci(search, ui->nameCaseInsensitive->isChecked());
|
||||
fm_search_set_name_regex(search, ui->nameRegExp->isChecked());
|
||||
|
||||
fm_search_set_content_pattern(search, ui->contentPattern->text().toUtf8().constData());
|
||||
fm_search_set_content_ci(search, ui->contentCaseInsensitive->isChecked());
|
||||
fm_search_set_content_regex(search, ui->contentRegExp->isChecked());
|
||||
|
||||
// search for the files of specific mime-types
|
||||
if(ui->searchTextFiles->isChecked())
|
||||
fm_search_add_mime_type(search, "text/plain");
|
||||
if(ui->searchImages->isChecked())
|
||||
fm_search_add_mime_type(search, "image/*");
|
||||
if(ui->searchAudio->isChecked())
|
||||
fm_search_add_mime_type(search, "audio/*");
|
||||
if(ui->searchVideo->isChecked())
|
||||
fm_search_add_mime_type(search, "video/*");
|
||||
if(ui->searchFolders->isChecked())
|
||||
fm_search_add_mime_type(search, "inode/directory");
|
||||
if(ui->searchDocuments->isChecked()) {
|
||||
const char* doc_types[] = {
|
||||
"application/pdf",
|
||||
/* "text/html;" */
|
||||
"application/vnd.oasis.opendocument.*",
|
||||
"application/vnd.openxmlformats-officedocument.*",
|
||||
"application/msword;application/vnd.ms-word",
|
||||
"application/msexcel;application/vnd.ms-excel"
|
||||
};
|
||||
for(i = 0; i < sizeof(doc_types)/sizeof(char*); ++i)
|
||||
fm_search_add_mime_type(search, doc_types[i]);
|
||||
}
|
||||
|
||||
// search based on file size
|
||||
const unsigned int unit_bytes[] = {1, (1024), (1024*1024), (1024*1024*1024)};
|
||||
if(ui->largerThan->isChecked()) {
|
||||
guint64 size = ui->minSize->value() * unit_bytes[ui->minSizeUnit->currentIndex()];
|
||||
fm_search_set_min_size(search, size);
|
||||
}
|
||||
|
||||
if(ui->smallerThan->isChecked()) {
|
||||
guint64 size = ui->maxSize->value() * unit_bytes[ui->maxSizeUnit->currentIndex()];
|
||||
fm_search_set_min_size(search, size);
|
||||
}
|
||||
|
||||
// search based on file mtime (we only support date in YYYY-MM-DD format)
|
||||
if(ui->earlierThan->isChecked()) {
|
||||
fm_search_set_max_mtime(search, ui->maxTime->date().toString(QStringLiteral("yyyy-MM-dd")).toUtf8().constData());
|
||||
}
|
||||
if(ui->laterThan->isChecked()) {
|
||||
fm_search_set_min_mtime(search, ui->minTime->date().toString(QStringLiteral("yyyy-MM-dd")).toUtf8().constData());
|
||||
}
|
||||
|
||||
searchUri_.take(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."));
|
||||
return;
|
||||
}
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void FileSearchDialog::onAddPath() {
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder"));
|
||||
if(dir.isEmpty())
|
||||
return;
|
||||
// avoid adding duplicated items
|
||||
if(ui->listView->findItems(dir, Qt::MatchFixedString|Qt::MatchCaseSensitive).isEmpty()) {
|
||||
ui->listView->addItem(dir);
|
||||
}
|
||||
}
|
||||
|
||||
void FileSearchDialog::onRemovePath() {
|
||||
// remove selected items
|
||||
Q_FOREACH(QListWidgetItem* item, ui->listView->selectedItems()) {
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 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_FILESEARCHDIALOG_H
|
||||
#define FM_FILESEARCHDIALOG_H
|
||||
|
||||
#include "libfmqtglobals.h"
|
||||
#include <QDialog>
|
||||
#include "path.h"
|
||||
|
||||
namespace Ui {
|
||||
class SearchDialog;
|
||||
}
|
||||
|
||||
namespace Fm {
|
||||
|
||||
class LIBFM_QT_API FileSearchDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
FileSearchDialog(QStringList paths = QStringList(), QWidget * parent = 0, Qt::WindowFlags f = 0);
|
||||
~FileSearchDialog();
|
||||
|
||||
Path searchUri() const {
|
||||
return searchUri_;
|
||||
}
|
||||
|
||||
virtual void accept();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onAddPath();
|
||||
void onRemovePath();
|
||||
|
||||
private:
|
||||
Ui::SearchDialog* ui;
|
||||
Path searchUri_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // FM_FILESEARCHDIALOG_H
|
@ -0,0 +1,317 @@
|
||||
/*
|
||||
* fm-search-uri.c
|
||||
*
|
||||
* Copyright 2015 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||
* Copyright 2012-2014 Andriy Grytsenko (LStranger) <andrej@rep.kiev.ua>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "fm-search.h"
|
||||
#include <string.h>
|
||||
|
||||
struct _FmSearch
|
||||
{
|
||||
gboolean recursive;
|
||||
gboolean show_hidden;
|
||||
char* name_patterns;
|
||||
gboolean name_ci;
|
||||
gboolean name_regex;
|
||||
char* content_pattern;
|
||||
gboolean content_ci;
|
||||
gboolean content_regex;
|
||||
GList* mime_types;
|
||||
GList* search_path_list;
|
||||
guint64 max_size;
|
||||
guint64 min_size;
|
||||
char* max_mtime;
|
||||
char* min_mtime;
|
||||
};
|
||||
|
||||
FmSearch* fm_search_new (void)
|
||||
{
|
||||
FmSearch* search = (FmSearch*)g_slice_new0(FmSearch);
|
||||
return search;
|
||||
}
|
||||
|
||||
void fm_search_free(FmSearch* search)
|
||||
{
|
||||
g_list_free_full(search->mime_types, (GDestroyNotify)g_free);
|
||||
g_list_free_full(search->search_path_list, (GDestroyNotify)g_free);
|
||||
g_free(search->name_patterns);
|
||||
g_free(search->content_pattern);
|
||||
g_free(search->max_mtime);
|
||||
g_free(search->min_mtime);
|
||||
g_slice_free(FmSearch, search);
|
||||
}
|
||||
|
||||
gboolean fm_search_get_recursive(FmSearch* search)
|
||||
{
|
||||
return search->recursive;
|
||||
}
|
||||
|
||||
void fm_search_set_recursive(FmSearch* search, gboolean recursive)
|
||||
{
|
||||
search->recursive = recursive;
|
||||
}
|
||||
|
||||
gboolean fm_search_get_show_hidden(FmSearch* search)
|
||||
{
|
||||
return search->show_hidden;
|
||||
}
|
||||
|
||||
void fm_search_set_show_hidden(FmSearch* search, gboolean show_hidden)
|
||||
{
|
||||
search->show_hidden = show_hidden;
|
||||
}
|
||||
|
||||
const char* fm_search_get_name_patterns(FmSearch* search)
|
||||
{
|
||||
return search->name_patterns;
|
||||
}
|
||||
|
||||
void fm_search_set_name_patterns(FmSearch* search, const char* name_patterns)
|
||||
{
|
||||
g_free(search->name_patterns);
|
||||
search->name_patterns = g_strdup(name_patterns);
|
||||
}
|
||||
|
||||
gboolean fm_search_get_name_ci(FmSearch* search)
|
||||
{
|
||||
return search->name_ci;
|
||||
}
|
||||
|
||||
void fm_search_set_name_ci(FmSearch* search, gboolean name_ci)
|
||||
{
|
||||
search->name_ci = name_ci;
|
||||
}
|
||||
|
||||
gboolean fm_search_get_name_regex(FmSearch* search)
|
||||
{
|
||||
return search->name_regex;
|
||||
}
|
||||
|
||||
void fm_search_set_name_regex(FmSearch* search, gboolean name_regex)
|
||||
{
|
||||
search->name_regex = name_regex;
|
||||
}
|
||||
|
||||
const char* fm_search_get_content_pattern(FmSearch* search)
|
||||
{
|
||||
return search->content_pattern;
|
||||
}
|
||||
|
||||
void fm_search_set_content_pattern(FmSearch* search, const char* content_pattern)
|
||||
{
|
||||
g_free(search->content_pattern);
|
||||
search->content_pattern = g_strdup(content_pattern);
|
||||
}
|
||||
|
||||
gboolean fm_search_get_content_ci(FmSearch* search)
|
||||
{
|
||||
return search->content_ci;
|
||||
}
|
||||
|
||||
void fm_search_set_content_ci(FmSearch* search, gboolean content_ci)
|
||||
{
|
||||
search->content_ci = content_ci;
|
||||
}
|
||||
|
||||
gboolean fm_search_get_content_regex(FmSearch* search)
|
||||
{
|
||||
return search->content_regex;
|
||||
}
|
||||
|
||||
void fm_search_set_content_regex(FmSearch* search, gboolean content_regex)
|
||||
{
|
||||
search->content_regex = content_regex;
|
||||
}
|
||||
|
||||
void fm_search_add_dir(FmSearch* search, const char* dir)
|
||||
{
|
||||
GList* l = g_list_find_custom(search->search_path_list, dir, (GCompareFunc)strcmp);
|
||||
if(!l)
|
||||
search->search_path_list = g_list_prepend(search->search_path_list, g_strdup(dir));
|
||||
}
|
||||
|
||||
void fm_search_remove_dir(FmSearch* search, const char* dir)
|
||||
{
|
||||
GList* l = g_list_find_custom(search->search_path_list, dir, (GCompareFunc)strcmp);
|
||||
if(G_LIKELY(l))
|
||||
{
|
||||
g_free(l->data);
|
||||
search->search_path_list = g_list_delete_link(search->search_path_list, l);
|
||||
}
|
||||
}
|
||||
|
||||
GList* fm_search_get_dirs(FmSearch* search)
|
||||
{
|
||||
return search->search_path_list;
|
||||
}
|
||||
|
||||
void fm_search_add_mime_type(FmSearch* search, const char* mime_type)
|
||||
{
|
||||
GList* l = g_list_find_custom(search->mime_types, mime_type, (GCompareFunc)strcmp);
|
||||
if(!l)
|
||||
search->mime_types = g_list_prepend(search->mime_types, g_strdup(mime_type));
|
||||
}
|
||||
|
||||
void fm_search_remove_mime_type(FmSearch* search, const char* mime_type)
|
||||
{
|
||||
GList* l = g_list_find_custom(search->mime_types, mime_type, (GCompareFunc)strcmp);
|
||||
if(G_LIKELY(l))
|
||||
{
|
||||
g_free(l->data);
|
||||
search->mime_types = g_list_delete_link(search->mime_types, l);
|
||||
}
|
||||
}
|
||||
|
||||
GList* fm_search_get_mime_types(FmSearch* search)
|
||||
{
|
||||
return search->mime_types;
|
||||
}
|
||||
|
||||
guint64 fm_search_get_max_size(FmSearch* search)
|
||||
{
|
||||
return search->max_size;
|
||||
}
|
||||
|
||||
void fm_search_set_max_size(FmSearch* search, guint64 size)
|
||||
{
|
||||
search->max_size = size;
|
||||
}
|
||||
|
||||
guint64 fm_search_get_min_size(FmSearch* search)
|
||||
{
|
||||
return search->min_size;
|
||||
}
|
||||
|
||||
void fm_search_set_min_size(FmSearch* search, guint64 size)
|
||||
{
|
||||
search->min_size = size;
|
||||
}
|
||||
|
||||
/* format of mtime: YYYY-MM-DD */
|
||||
const char* fm_search_get_max_mtime(FmSearch* search)
|
||||
{
|
||||
return search->max_mtime;
|
||||
}
|
||||
|
||||
void fm_search_set_max_mtime(FmSearch* search, const char* mtime)
|
||||
{
|
||||
g_free(search->max_mtime);
|
||||
search->max_mtime = g_strdup(mtime);
|
||||
}
|
||||
|
||||
/* format of mtime: YYYY-MM-DD */
|
||||
const char* fm_search_get_min_mtime(FmSearch* search)
|
||||
{
|
||||
return search->min_mtime;
|
||||
}
|
||||
|
||||
void fm_search_set_min_mtime(FmSearch* search, const char* mtime)
|
||||
{
|
||||
g_free(search->min_mtime);
|
||||
search->min_mtime = g_strdup(mtime);
|
||||
}
|
||||
|
||||
/* really build the path */
|
||||
FmPath* fm_search_dup_path(FmSearch* search)
|
||||
{
|
||||
FmPath* search_path = NULL;
|
||||
GString* search_str = g_string_sized_new(1024);
|
||||
/* build the search:// URI to perform the search */
|
||||
g_string_append(search_str, "search://");
|
||||
|
||||
if(search->search_path_list) /* we need to have at least one dir path */
|
||||
{
|
||||
char *escaped;
|
||||
/* add paths */
|
||||
GList* l;
|
||||
for(l = search->search_path_list; ; )
|
||||
{
|
||||
char *path_str = (char*)l->data;
|
||||
/* escape possible '?' and ',' */
|
||||
escaped = g_uri_escape_string(path_str, "!$&'()*+:;=/@", TRUE);
|
||||
g_string_append(search_str, escaped);
|
||||
g_free(escaped);
|
||||
|
||||
l = l->next;
|
||||
if(!l) /* no more items */
|
||||
break;
|
||||
g_string_append_c(search_str, ','); /* separator for paths */
|
||||
}
|
||||
|
||||
g_string_append_c(search_str, '?');
|
||||
g_string_append_printf(search_str, "recursive=%c", search->recursive ? '1' : '0');
|
||||
g_string_append_printf(search_str, "&show_hidden=%c", search->show_hidden ? '1' : '0');
|
||||
if(search->name_patterns && *search->name_patterns)
|
||||
{
|
||||
/* escape ampersands in pattern */
|
||||
escaped = g_uri_escape_string(search->name_patterns, ":/?#[]@!$'()*+,;", TRUE);
|
||||
if(search->name_regex)
|
||||
g_string_append_printf(search_str, "&name_regex=%s", escaped);
|
||||
else
|
||||
g_string_append_printf(search_str, "&name=%s", escaped);
|
||||
if(search->name_ci)
|
||||
g_string_append_printf(search_str, "&name_ci=%c", search->name_ci ? '1' : '0');
|
||||
g_free(escaped);
|
||||
}
|
||||
|
||||
if(search->content_pattern && *search->content_pattern)
|
||||
{
|
||||
/* escape ampersands in pattern */
|
||||
escaped = g_uri_escape_string(search->content_pattern, ":/?#[]@!$'()*+,;^<>{}", TRUE);
|
||||
if(search->content_regex)
|
||||
g_string_append_printf(search_str, "&content_regex=%s", escaped);
|
||||
else
|
||||
g_string_append_printf(search_str, "&content=%s", escaped);
|
||||
g_free(escaped);
|
||||
if(search->content_ci)
|
||||
g_string_append_printf(search_str, "&content_ci=%c", search->content_ci ? '1' : '0');
|
||||
}
|
||||
|
||||
/* search for the files of specific mime-types */
|
||||
if(search->mime_types)
|
||||
{
|
||||
GList* l;
|
||||
g_string_append(search_str, "&mime_types=");
|
||||
for(l = search->mime_types; l; l=l->next)
|
||||
{
|
||||
const char* mime_type = (const char*)l->data;
|
||||
g_string_append(search_str, mime_type);
|
||||
if(l->next)
|
||||
g_string_append_c(search_str, ';');
|
||||
}
|
||||
}
|
||||
|
||||
if(search->min_size)
|
||||
g_string_append_printf(search_str, "&min_size=%llu", search->min_size);
|
||||
|
||||
if(search->max_size)
|
||||
g_string_append_printf(search_str, "&max_size=%llu", search->max_size);
|
||||
|
||||
if(search->min_mtime)
|
||||
g_string_append_printf(search_str, "&min_mtime=%s", search->min_mtime);
|
||||
|
||||
if(search->max_mtime)
|
||||
g_string_append_printf(search_str, "&max_mtime=%s", search->max_mtime);
|
||||
|
||||
search_path = fm_path_new_for_uri(search_str->str);
|
||||
g_string_free(search_str, TRUE);
|
||||
}
|
||||
return search_path;
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* fm-search-uri.h
|
||||
*
|
||||
* Copyright 2015 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* FmSearch implements a tool used to generate a search:// URI used by libfm to search for files.
|
||||
* This API might become part of libfm in the future.
|
||||
*/
|
||||
|
||||
#ifndef _FM_SEARCH_H_
|
||||
#define _FM_SEARCH_H_
|
||||
|
||||
#include <libfm/fm.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _FmSearch FmSearch;
|
||||
|
||||
FmSearch* fm_search_new(void);
|
||||
void fm_search_free(FmSearch* search);
|
||||
|
||||
FmPath* fm_search_dup_path(FmSearch* search);
|
||||
|
||||
gboolean fm_search_get_recursive(FmSearch* search);
|
||||
void fm_search_set_recursive(FmSearch* search, gboolean recursive);
|
||||
|
||||
gboolean fm_search_get_show_hidden(FmSearch* search);
|
||||
void fm_search_set_show_hidden(FmSearch* search, gboolean show_hidden);
|
||||
|
||||
const char* fm_search_get_name_patterns(FmSearch* search);
|
||||
void fm_search_set_name_patterns(FmSearch* search, const char* name_patterns);
|
||||
|
||||
gboolean fm_search_get_name_ci(FmSearch* search);
|
||||
void fm_search_set_name_ci(FmSearch* search, gboolean name_ci);
|
||||
|
||||
gboolean fm_search_get_name_regex(FmSearch* search);
|
||||
void fm_search_set_name_regex(FmSearch* search, gboolean name_regex);
|
||||
|
||||
const char* fm_search_get_content_pattern(FmSearch* search);
|
||||
void fm_search_set_content_pattern(FmSearch* search, const char* content_pattern);
|
||||
|
||||
gboolean fm_search_get_content_ci(FmSearch* search);
|
||||
void fm_search_set_content_ci(FmSearch* search, gboolean content_ci);
|
||||
|
||||
gboolean fm_search_get_content_regex(FmSearch* search);
|
||||
void fm_search_set_content_regex(FmSearch* search, gboolean content_regex);
|
||||
|
||||
void fm_search_add_dir(FmSearch* search, const char* dir);
|
||||
void fm_search_remove_dir(FmSearch* search, const char* dir);
|
||||
GList* fm_search_get_dirs(FmSearch* search);
|
||||
|
||||
void fm_search_add_mime_type(FmSearch* search, const char* mime_type);
|
||||
void fm_search_remove_mime_type(FmSearch* search, const char* mime_type);
|
||||
GList* fm_search_get_mime_types(FmSearch* search);
|
||||
|
||||
guint64 fm_search_get_max_size(FmSearch* search);
|
||||
void fm_search_set_max_size(FmSearch* search, guint64 size);
|
||||
|
||||
guint64 fm_search_get_min_size(FmSearch* search);
|
||||
void fm_search_set_min_size(FmSearch* search, guint64 size);
|
||||
|
||||
/* format of mtime: YYYY-MM-DD */
|
||||
const char* fm_search_get_max_mtime(FmSearch* search);
|
||||
void fm_search_set_max_mtime(FmSearch* search, const char* mtime);
|
||||
|
||||
/* format of mtime: YYYY-MM-DD */
|
||||
const char* fm_search_get_min_mtime(FmSearch* search);
|
||||
void fm_search_set_min_mtime(FmSearch* search, const char* mtime);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _FM_SEARCH_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +0,0 @@
|
||||
[Project]
|
||||
Manager=KDevCMakeManager
|
||||
Name=pcmanfm-qt
|
||||
VersionControl=
|
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DesktopFolder</class>
|
||||
<widget class="QWidget" name="DesktopFolder">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>352</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Desktop</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Desktop folder:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="desktopFolder">
|
||||
<property name="toolTip">
|
||||
<string>Image file</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Folder path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="browseDesktopFolder">
|
||||
<property name="text">
|
||||
<string>&Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
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
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue