Example #1
0
/**
 * Constructor.
 *
 * @param message The error message to be displayed
 * @param data The line of CSV data which triggered the error
 * @param parent The parent widget, if any
 */
CSVErrorDialog::CSVErrorDialog(const QString &message, const QString &data, QWidget *parent)
  : PBDialog("", parent)
{
    vbox->addWidget(new QLabel(message, this));
    vbox->addWidget(new QLabel(tr("Problematic row") + ":", this));

    QTextEdit *dataBox = new QTextEdit(parent);
    dataBox->setReadOnly(true);
#if defined(Q_WS_MAEMO_5)
    QVariant ksProp = dataBox->property("kineticScroller");
    QAbstractKineticScroller *ks = ksProp.value<QAbstractKineticScroller *>();
    if (ks) {
        ks->setEnabled(true);
    }
#endif
    dataBox->setLineWrapMode(QTextEdit::NoWrap);
    dataBox->setPlainText(data);
    vbox->addWidget(dataBox);

    finishLayout(true, false);
}
//--- Apply --------------------------------------------------------------------
// create apply
void MainWindow::createApply()
{
    applyLog = new QTextEdit(ui->applyPage);
    applyLog->setCursorWidth(0);
    applyLog->setTextInteractionFlags(Qt::TextSelectableByMouse);
    applyLog->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

    ui->scrollArea->setWidget(applyLog);
    ui->scrollArea->setWidgetResizable(true);

#ifdef Q_WS_MAEMO_5
    QAbstractKineticScroller *scroller;
    scroller = applyLog->property("kineticScroller").value<QAbstractKineticScroller*>();
    scroller->setMode(QAbstractKineticScroller::PushMode);
    scroller->setOvershootPolicy(QAbstractKineticScroller::OvershootAlwaysOff);
    scroller->setEnabled(true);
#endif

    connect(ui->applyCheckBtn, SIGNAL(clicked()), this, SLOT(checkAll()));
    connect(ui->applyPatchBtn, SIGNAL(clicked()), this, SLOT(patchNolo()));
    connect(ui->applyReturnBtn, SIGNAL(clicked()), this, SLOT(closeApply()));
}