~ubuntu-branches/ubuntu/quantal/qgis/quantal

« back to all changes in this revision

Viewing changes to src/qgsattributeaction.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve Halasz
  • Date: 2005-11-05 16:04:45 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051105160445-l0g4isz5bc9yehet
Tags: 0.7.4-1
* New upstream release
* Build GRASS support in qgis-plugin-grass package (Closes: #248649)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 *   (at your option) any later version.                                   *
22
22
 *                                                                         *
23
23
 ***************************************************************************/
24
 
/*  $Id: qgsattributeaction.cpp,v 1.4.2.1 2004/12/03 21:54:18 g_j_m Exp $ */
 
24
/*  $Id: qgsattributeaction.cpp,v 1.7 2005/01/19 23:59:10 g_j_m Exp $ */
25
25
 
26
26
#include <iostream>
 
27
#include <vector>
27
28
 
28
29
#include <qstringlist.h>
29
 
#include <qmessagebox.h>
30
30
#include <qdom.h>
31
31
 
32
32
#include "qgsattributeaction.h"
 
33
#include "qgsrunprocess.h"
33
34
 
34
 
static const char * const ident_ = "$Id: qgsattributeaction.cpp,v 1.4.2.1 2004/12/03 21:54:18 g_j_m Exp $";
 
35
static const char * const ident_ = "$Id: qgsattributeaction.cpp,v 1.7 2005/01/19 23:59:10 g_j_m Exp $";
35
36
 
36
37
void QgsAttributeAction::addAction(QString name, QString action,
37
38
                                   bool capture)
95
96
    if (!current_arg.stripWhiteSpace().isEmpty())
96
97
      args << expandAction(current_arg.stripWhiteSpace(), values, defaultValueIndex);
97
98
 
98
 
    QString whole_cmd;
99
 
    for (int i = 0; i < args.count(); ++i)
100
 
      whole_cmd += "[" + args[i] + "] ";
101
 
    std::cout << "Running command: " << whole_cmd << "\n";
102
 
 
103
 
    process = new QProcess();
104
 
    process->setArguments(args);
105
 
    if (!process->start())
106
 
    {
107
 
      QMessageBox::critical(0, "Unable to run command", 
108
 
                            "Unable to run the command \n" + whole_cmd +
109
 
                            "\n", QMessageBox::Ok, QMessageBox::NoButton);
110
 
    }
111
 
    delete process;
 
99
    // The QgsRunProcess instance created by this static function
 
100
    // deletes itself when no longer needed.
 
101
    QgsRunProcess::create(args, action->capture());
112
102
  }
113
103
}
114
104
 
197
187
  }
198
188
  return true;
199
189
}
 
190