void BookmarksImportDialog::nextPage()
{
    switch (m_currentPage) {
    case 0:
        if (!ui->browserList->currentItem()) {
            return;
        }

        m_browser = (Browser)(ui->browserList->currentRow());
        setupBrowser(m_browser);
        ui->iconLabel->setPixmap(m_browserPixmap);
        ui->importingFromLabel->setText(tr("<b>Importing from %1</b>").arg(m_browserName));
        ui->fileText1->setText(m_browserFileText);
        ui->fileText2->setText(m_browserFileText2);
        ui->standardDirLabel->setText("<i>" + m_standardDir + "</i>");
        ui->nextButton->setEnabled(false);

        m_currentPage++;
        ui->stackedWidget->setCurrentIndex(m_currentPage);
        break;

    case 1:
        if (ui->fileLine->text().isEmpty()) {
            return;
        }

        if (exportedOK()) {
            m_currentPage++;
            ui->stackedWidget->setCurrentIndex(m_currentPage);
            startFetchingIcons();
        }
        break;

    case 2:
        addExportedBookmarks();
        close();
        break;

    default:
        break;
    }
}
void BookmarksImportDialog::nextPage()
{
    switch (m_currentPage) {
    case 0:
        if (!ui->browserList->currentItem()) {
            return;
        }

        switch (ui->browserList->currentRow()) {
        case Firefox:
            m_importer = new FirefoxImporter;
            break;
        case Chrome:
            m_importer = new ChromeImporter;
            break;
        case Opera:
            m_importer = new OperaImporter;
            break;
        case IE:
            m_importer = new IeImporter;
            break;
        case Html:
            m_importer = new HtmlImporter;
            break;
        default:
            Q_ASSERT(!"Unreachable");
            break;
        }

        ui->fileLine->clear();
        showImporterPage();

        ui->nextButton->setEnabled(false);
        ui->backButton->setEnabled(true);
        ui->stackedWidget->setCurrentIndex(++m_currentPage);
        break;

    case 1:
        if (ui->fileLine->text().isEmpty()) {
            return;
        }

        if (m_importer->prepareImport()) {
            m_importedFolder = m_importer->importBookmarks();
        }

        if (m_importer->error()) {
            QMessageBox::critical(this, tr("Error!"), m_importer->errorString());
            return;
        }

        if (!m_importedFolder || m_importedFolder->children().isEmpty()) {
            QMessageBox::warning(this, tr("Error!"), tr("No bookmarks were found."));
            return;
        }

        Q_ASSERT(m_importedFolder->isFolder());

        ui->stackedWidget->setCurrentIndex(++m_currentPage);
        ui->nextButton->setText(tr("Finish"));
        showExportedBookmarks();
        break;

    case 2:
        addExportedBookmarks();
        close();
        break;

    default:
        Q_ASSERT(!"Unreachable");
    }
}