Permalink
Browse files

trim the textbox inputs in hunter config dialog

  • Loading branch information...
agentzh
agentzh committed Jun 13, 2009
1 parent 0195e07 commit 25bc6a52945259e02fcd030fba78b518e2bfbb71
Showing with 10 additions and 10 deletions.
  1. +5 −5 hunterconfigdialog.cpp
  2. +4 −4 hunterconfigdialog.h
  3. +1 −1 mainwindow.cpp
View
@@ -71,25 +71,25 @@ HunterConfigDialog::HunterConfigDialog(QWidget *parent): QDialog(parent) {
void HunterConfigDialog::accept() {
//qDebug() << "Checking form values...\n";
if (formGroup->isChecked()) {
- QString progPath = progPathEdit->text();
+ QString progPath = progPathEdit->text().trimmed();
if (progPath.isEmpty()) {
croak(tr("Hunter Program Path is empty."));
progPathEdit->selectAll();
return;
}
if (! QFile::exists(progPath)) {
- croak(tr("Hunter Program File not found."));
+ croak(tr("Hunter Program File \"%1\" not found.").arg(progPath));
progPathEdit->selectAll();
return;
}
QFile::Permissions perms = QFile::permissions(progPath);
if (! (perms & QFile::ExeUser)) {
- croak(tr("Hunter Program File is not executable."));
+ croak(tr("Hunter Program File \"%1\" is not executable.").arg(progPath));
progPathEdit->selectAll();
return;
}
- QString vdomPath = vdomPathEdit->text();
+ QString vdomPath = vdomPathEdit->text().trimmed();
if (vdomPath.isEmpty()) {
croak(tr("VDOM Output File Path is empty."));
vdomPathEdit->selectAll();
@@ -99,7 +99,7 @@ void HunterConfigDialog::accept() {
//qDebug() << "VDOM Path " << vdomPath << " exists.\n";
perms = QFile::permissions(vdomPath);
if (! (perms & QFile::WriteUser)) {
- croak(tr("VDOM Output File Path is not writable."));
+ croak(tr("VDOM Output File \"%1\" is not writable.").arg(vdomPath));
vdomPathEdit->selectAll();
return;
}
View
@@ -16,23 +16,23 @@ class HunterConfigDialog: public QDialog {
}
void setProgPath(const QString& path) {
- progPathEdit->setText(path);
+ progPathEdit->setText(path.trimmed());
}
void setVdomPath(const QString& path) {
- vdomPathEdit->setText(path);
+ vdomPathEdit->setText(path.trimmed());
}
bool hunterEnabled() {
return formGroup->isChecked();
}
QString progPath() const {
- return progPathEdit->text();
+ return progPathEdit->text().trimmed();
}
QString vdomPath() const {
- return vdomPathEdit->text();
+ return vdomPathEdit->text().trimmed();
}
public slots:
View
@@ -78,7 +78,7 @@ void MainWindow::changeLocation() {
void MainWindow::loadFinished(bool done) {
if (!done) {
QMessageBox::warning(this, tr("Browser Loader"),
- QString("Failed to open resource %1.").arg(m_urlEdit->text()),
+ QString("Failed to open resource %1.").arg(m_urlEdit->text().trimmed()),
QMessageBox::NoButton);
return;
}

0 comments on commit 25bc6a5

Please sign in to comment.