~ubuntu-branches/ubuntu/quantal/kdevplatform/quantal-proposed

« back to all changes in this revision

Viewing changes to plugins/grepview/grepjob.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-24 00:06:18 UTC
  • mfrom: (0.3.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20101024000618-7otebin77mfcmt3b
Tags: 1.1.0-0ubuntu1
* New upstream release
  - Bump build-dependencies
  - Build against libboost-serialization1.42-dev
  - Update kdevplatform1-libs.install
  - Update kdevplatform-dev.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
            }
87
87
            if (!projectFiles.isEmpty())
88
88
            {
 
89
                qSort(projectFiles);
89
90
                QList<QRegExp> regExpList;
90
91
 
91
92
                if (!filelist.isEmpty())
205
206
    xargsCmd << "-e";
206
207
 
207
208
    QString pattern = templateString;
208
 
    if (regexpFlag)
209
 
        pattern.replace(QRegExp("%s"), patternString());
210
 
    else
211
 
        pattern.replace(QRegExp("%s"), escape( patternString() ) );
 
209
    {
 
210
        QString subst = patternString();
 
211
        if(regexpFlag)
 
212
            subst = escape(subst);
 
213
        QString modified;
 
214
        bool expectEscape = false;
 
215
        for(int i=0; i<pattern.length(); i++)
 
216
        {
 
217
            if(expectEscape)
 
218
            {
 
219
                expectEscape = false;
 
220
                if(pattern[i] == '%')
 
221
                    modified += '%';
 
222
                else if(pattern[i] == 's')
 
223
                    modified += subst;
 
224
                else
 
225
                    modified += QChar('%') + pattern[i];
 
226
                continue;
 
227
            }
 
228
            if(pattern[i] == '%')
 
229
            {
 
230
                expectEscape = true;
 
231
                continue;
 
232
            }
 
233
            modified += pattern[i];
 
234
        }
 
235
        pattern = modified;
 
236
    }
212
237
//     command += KShellProcess::quote(pattern);
213
238
//     xargsCmd += quote(pattern); // quote isn't needed now.
214
239
    xargsCmd << pattern;