Ejemplo n.º 1
0
void CheckoutDialog::jobFinished(KJob * job)
{
    if (job->error()) {
        KMessageBox::error(this, i18n("Error on checkout"), i18n("Checkout Error"));
        return;
    }

    // The job finished, now let's check the output is everything was OK
    CvsJob* cvsjob = dynamic_cast<CvsJob*>(job);

    static QRegExp re_file("^.\\s(.*)");
    bool error = false;
    QStringList lines = cvsjob->output().split('\n');
    foreach(const QString &line, lines) {
        if (line.isEmpty()) {
            // ignore empty lines
            continue;
        } else if (re_file.exactMatch(line)) {
            // line that tell us that a file has been checkedout
            continue;
        } else {
            // any other line must mean that an error occurred
            qCDebug(PLUGIN_CVS) << line;
            error = true;
        }
    }

    if (error) {
        KMessageBox::error(this,
            i18n("Some errors occurred while checking out into %1", localWorkingDir->url().toLocalFile()),
            i18n("Checkout Error"));
    } else {
        QDialog::accept();
    }
}
Ejemplo n.º 2
0
void ImportDialog::jobFinished(KJob * job)
{
    if (job->error()) {
        KMessageBox::error(this, i18n("Error on importing"), i18n("Import Error"));
        return;
    }

    // The job finished, now let's check the output is everything was OK
    CvsJob* cvsjob = dynamic_cast<CvsJob*>(job);

    static QRegExp re_file("^[IN]\\s(.*)");
    bool error = false;
    QStringList lines = cvsjob->output().split('\n');
    foreach(const QString &line, lines) {
        if (line.isEmpty()) {
            // ignore empty lines
            continue;
        } else if (re_file.exactMatch(line)) {
            // line that tell us that a file has been added are OK
            continue;
            // this normaly should be the last line
        } else if (line.contains("No conflicts created by this import")) {
            continue;
        } else {
            // any other line must mean that an error occurred
            kDebug(9500) <<"ERR: "<< line;
            error = true;
        }
    }

    if (error) {
        KMessageBox::error(this,
            i18n("Some errors occurred while importing %1", m_url.toLocalFile()),
            i18n("Import Error"));
    } else {
        KDialog::accept();
    }
}