From kwrite-devel Thu Dec 05 13:35:47 2002 From: Andras Mantia Date: Thu, 05 Dec 2002 13:35:47 +0000 To: kwrite-devel Subject: [PATCH] grep dialog X-MARC-Message: https://marc.info/?l=kwrite-devel&m=103909560814114 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_zY179uJZqtMjErO" --Boundary-00=_zY179uJZqtMjErO Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, The attached patch makes the grep dialog working when the directory structure contains many-many files. Andras --Boundary-00=_zY179uJZqtMjErO Content-Type: text/x-diff; charset="us-ascii"; name="grep.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="grep.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)), --Boundary-00=_zY179uJZqtMjErO-- _______________________________________________ KWrite-Devel mailing list KWrite-Devel@mail.kde.org http://mail.kde.org/mailman/listinfo/kwrite-devel