~ubuntu-branches/ubuntu/gutsy/kde4libs/gutsy

« back to all changes in this revision

Viewing changes to kdeprint/lpr/matichandler.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-02-21 11:00:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070221110012-6kw8khr9knv6lmg1
Tags: 3.80.3-0ubuntu1
New upstream unstable release

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include <krandom.h>
35
35
#include <kdebug.h>
36
36
#include <kprocess.h>
 
37
#include <qprocess.h>
37
38
#include <qfile.h>
38
39
#include <qtextstream.h>
39
40
#include <qregexp.h>
136
137
                {
137
138
                        url = "socket://" + args[ 1 ];
138
139
                        if ( args.count() > 2 )
139
 
                                url += ":" + args[ 2 ];
 
140
                                url += ':' + args[ 2 ];
140
141
                        else
141
142
                                url += ":9100";
142
143
                }
162
163
                        int     i=1;
163
164
                        while (i < args.count())
164
165
                        {
165
 
                                if (args[i].left(2) != "-P")
 
166
                                if (!args[i].startsWith(QLatin1String("-P")))
166
167
                                        i++;
167
168
                                else
168
169
                                {
189
190
        if (prot == "socket")
190
191
        {
191
192
                str += ("| " + m_ncpath);
192
 
                str += (" " + url.host());
 
193
                str += (' ' + url.host());
193
194
                if (url.port() > 0)
194
 
                        str += (" " + QString::number(url.port()));
 
195
                        str += (' ' + QString::number(url.port()));
195
196
        }
196
197
        else if (prot == "lpd")
197
198
        {
207
208
                        str += ("| (\\n echo \\\"print -\\\"\\n cat \\n) | " + m_smbpath);
208
209
                        str += (" \\\"//" + server + "/" + printer + "\\\"");
209
210
                        if (!passwd.isEmpty())
210
 
                                str += (" " + passwd);
 
211
                                str += (' ' + passwd);
211
212
                        if (!user.isEmpty())
212
213
                                str += (" -U " + user);
213
214
                        if (!work.isEmpty())
225
226
        // changing printer name), the template would be also removed
226
227
        QString origfilename = maticFile(entry);
227
228
        QString filename = KStandardDirs::locateLocal("tmp", "foomatic_" + KRandom::randomString(8));
228
 
        ::system(QFile::encodeName("cp " + KProcess::quote(origfilename) + " " + KProcess::quote(filename)));
 
229
        QProcess::execute("cp", QStringList() << origfilename << filename);
229
230
        DrMain  *driver = Foomatic2Loader::loadDriver(filename);
230
231
        if (driver)
231
232
        {
329
330
                inFile.close();
330
331
                tmpFile.close();
331
332
 
332
 
                QString cmd = "mv " + KProcess::quote(tmpFile.fileName()) + " " + KProcess::quote(outFile);
 
333
                QString cmd = "mv " + KProcess::quote(tmpFile.fileName()) + ' ' + KProcess::quote(outFile);
333
334
                int     status = ::system(QFile::encodeName(cmd).data());
334
335
                QFile::remove(tmpFile.fileName());
335
336
                result = (status != -1 && WEXITSTATUS(status) == 0);
377
378
                                        DrBase  *opt = (optname.isEmpty() ? NULL : driver->findOption(optname));
378
379
                                        if (opt)
379
380
                                        {
380
 
                                                line.replace(foo2, "'"+opt->valueText()+"',");
 
381
                                                line.replace(foo2, '\''+opt->valueText()+"',");
381
382
                                        }
382
383
                                }
383
384
                                else if (foo.indexIn(line) != -1)
468
469
        {
469
470
                if (it.key().startsWith("kde-") || it.key().startsWith("_kde-") || it.key().startsWith( "app-" ))
470
471
                        continue;
471
 
                str += (" " + it.key() + "=" + (*it));
 
472
                str += (' ' + it.key() + '=' + (*it));
472
473
        }
473
474
        if (!str.isEmpty())
474
475
                str.prepend("-J '").append("'");