[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: [PATCH] grep dialog
From: Andras Mantia <amantia () virtualartisans ! com>
Date: 2002-12-05 13:35:47
[Download RAW message or body]
Hi,
The attached patch makes the grep dialog working when the directory structure
contains many-many files.
Andras
["grep.diff" (text/x-diff)]
--- /home/andris/cvs-developement/head/kde-cvs/kdebase/kate/app/kategrepdialog.cpp Wed Dec 4 12:15:35 2002
+++ kategrepdialog.cpp Thu Dec 5 15:29:47 2002
@@ -352,23 +352,24 @@
pattern.replace(QRegExp("%s"), pattern_combo->currentText());
pattern.replace(QRegExp("'"), "'\\''");
- QString filepattern = "`find '";
- filepattern += dir_combo->/*currentText*/url();
- filepattern += "'";
- if (!recursive_box->isChecked())
- filepattern += " -maxdepth 1";
- filepattern += " \\( -name ";
- filepattern += files;
- filepattern += " \\) -print";
- filepattern += "`";
-
- childproc = new KShellProcess();
- *childproc << "grep";
- *childproc << "-n";
- *childproc << (QString("-e '") + pattern + "'");
- *childproc << filepattern;
- *childproc << "/dev/null";
+ QString command = "find '";
+ command += dir_combo->url();
+ command += "'";
+ if (!recursive_box->isChecked())
+ command += " -maxdepth 1";
+ command += " \\( -name ";
+ command += files;
+ command += " \\) -print";
+ command += " | xargs ";
+ command += "grep -n ";
+ command += "-e '" + pattern + "' ";
+ command += " /dev/null";
+
+ childproc = new KProcess();
+ childproc->setUseShell(true);
+ *childproc << command;
+
connect( childproc, SIGNAL(processExited(KProcess *)),
SLOT(childExited()) );
connect( childproc, SIGNAL(receivedStdout(KProcess *, char *, int)),
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic