parent
1fa81fcbb4
commit
c98bcd1948
@ -1,25 +0,0 @@
|
||||
From 472128c3bfc301f3258bd99501a88ef4097d0429 Mon Sep 17 00:00:00 2001
|
||||
From: tsujan <tsujan2000@gmail.com>
|
||||
Date: Thu, 9 Jun 2022 01:35:27 +0430
|
||||
Subject: [PATCH] Fixed crash with empty URI scheme of folder path (#808)
|
||||
|
||||
An empty URI scheme is possible when trying to open a folder with an empty path (like when the desktop path is empty and pcmanfm-qt's desktop module is started).
|
||||
|
||||
Fixes https://github.com/lxqt/lxqt-session/issues/439
|
||||
---
|
||||
src/core/folder.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/folder.cpp b/src/core/folder.cpp
|
||||
index 5bb40137..710a9132 100644
|
||||
--- a/src/core/folder.cpp
|
||||
+++ b/src/core/folder.cpp
|
||||
@@ -532,7 +532,7 @@ void Folder::onDirListFinished() {
|
||||
const auto& infos = job->files();
|
||||
|
||||
// with "search://", there is no update for infos and all of them should be added
|
||||
- if(strcmp(dirPath_.uriScheme().get(), "search") == 0) {
|
||||
+ if(dirPath_.hasUriScheme("search")) {
|
||||
files_to_add = infos;
|
||||
for(auto& file: files_to_add) {
|
||||
files_[file->path().baseName().get()] = file;
|
@ -1,124 +0,0 @@
|
||||
From f66aa205c48a60378abcf0dac3d21b83d47aa2c5 Mon Sep 17 00:00:00 2001
|
||||
From: tsujan <tsujan2000@gmail.com>
|
||||
Date: Sat, 14 May 2022 01:17:14 +0430
|
||||
Subject: [PATCH] Support adding of pattern lists to entries of search dialog
|
||||
(#806)
|
||||
|
||||
Such lists will be used later for adding search history to `pcmanfm-qt`.
|
||||
---
|
||||
src/filesearch.ui | 13 ++++++++++---
|
||||
src/filesearchdialog.cpp | 28 ++++++++++++++++++++++++++--
|
||||
src/filesearchdialog.h | 6 ++++++
|
||||
3 files changed, 42 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/filesearch.ui b/src/filesearch.ui
|
||||
index 85e57556..a90456a5 100644
|
||||
--- a/src/filesearch.ui
|
||||
+++ b/src/filesearch.ui
|
||||
@@ -36,8 +36,11 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
- <widget class="QLineEdit" name="namePatterns">
|
||||
- <property name="text">
|
||||
+ <widget class="QComboBox" name="namePatterns">
|
||||
+ <property name="editable">
|
||||
+ <bool>true</bool>
|
||||
+ </property>
|
||||
+ <property name="currentText">
|
||||
<string>*</string>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -218,7 +221,11 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
- <widget class="QLineEdit" name="contentPattern"/>
|
||||
+ <widget class="QComboBox" name="contentPattern">
|
||||
+ <property name="editable">
|
||||
+ <bool>true</bool>
|
||||
+ </property>
|
||||
+ </widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="contentCaseSensitive">
|
||||
diff --git a/src/filesearchdialog.cpp b/src/filesearchdialog.cpp
|
||||
index 0216687f..267cc4c7 100644
|
||||
--- a/src/filesearchdialog.cpp
|
||||
+++ b/src/filesearchdialog.cpp
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "ui_filesearch.h"
|
||||
#include <limits>
|
||||
#include <QFileDialog>
|
||||
+#include <QCompleter>
|
||||
#include <utility>
|
||||
|
||||
namespace Fm {
|
||||
@@ -43,6 +44,10 @@ FileSearchDialog::FileSearchDialog(QStringList paths, QWidget* parent, Qt::Windo
|
||||
connect(ui->addPath, &QPushButton::clicked, this, &FileSearchDialog::onAddPath);
|
||||
connect(ui->removePath, &QPushButton::clicked, this, &FileSearchDialog::onRemovePath);
|
||||
|
||||
+ // the default completer is case-insensitive
|
||||
+ ui->namePatterns->completer()->setCaseSensitivity(Qt::CaseSensitive);
|
||||
+ ui->contentPattern->completer()->setCaseSensitivity(Qt::CaseSensitive);
|
||||
+
|
||||
ui->namePatterns->setFocus();
|
||||
}
|
||||
|
||||
@@ -50,6 +55,25 @@ FileSearchDialog::~FileSearchDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
+QString FileSearchDialog::namePattern() const {
|
||||
+ return ui->namePatterns->currentText();
|
||||
+}
|
||||
+
|
||||
+QString FileSearchDialog::contentPattern() const {
|
||||
+ return ui->contentPattern->currentText();
|
||||
+}
|
||||
+
|
||||
+void FileSearchDialog::addNamePatterns(const QStringList& patterns) {
|
||||
+ ui->namePatterns->addItems(patterns);
|
||||
+ ui->namePatterns->setCurrentIndex(-1);
|
||||
+ ui->namePatterns->setCurrentText(QLatin1String("*"));
|
||||
+}
|
||||
+
|
||||
+void FileSearchDialog::addContentPatterns(const QStringList& patterns) {
|
||||
+ ui->contentPattern->addItems(patterns);
|
||||
+ ui->contentPattern->setCurrentIndex(-1);
|
||||
+}
|
||||
+
|
||||
void FileSearchDialog::accept() {
|
||||
// build the search:/// uri
|
||||
int n = ui->listView->count();
|
||||
@@ -62,11 +86,11 @@ void FileSearchDialog::accept() {
|
||||
|
||||
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_patterns(search, ui->namePatterns->currentText().toUtf8().constData());
|
||||
fm_search_set_name_ci(search, !ui->nameCaseSensitive->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_pattern(search, ui->contentPattern->currentText().toUtf8().constData());
|
||||
fm_search_set_content_ci(search, !ui->contentCaseSensitive->isChecked());
|
||||
fm_search_set_content_regex(search, ui->contentRegExp->isChecked());
|
||||
|
||||
diff --git a/src/filesearchdialog.h b/src/filesearchdialog.h
|
||||
index 504c1ed0..2aee1b57 100644
|
||||
--- a/src/filesearchdialog.h
|
||||
+++ b/src/filesearchdialog.h
|
||||
@@ -59,6 +59,12 @@ class LIBFM_QT_API FileSearchDialog : public QDialog {
|
||||
bool searchhHidden() const;
|
||||
void setSearchhHidden(bool hidden);
|
||||
|
||||
+ QString namePattern() const;
|
||||
+ QString contentPattern() const;
|
||||
+
|
||||
+ void addNamePatterns(const QStringList& patterns);
|
||||
+ void addContentPatterns(const QStringList& patterns);
|
||||
+
|
||||
private Q_SLOTS:
|
||||
void onAddPath();
|
||||
void onRemovePath();
|
Loading…
Reference in new issue