Пример #1
0
void TableOfContentsConfigure::setDisplay()
{
    setVisible(true);

    ui.lineEditTitle->setText(m_tocInfo->m_indexTitleTemplate.text);
    ui.useOutline->setCheckState(m_tocInfo->m_useOutlineLevel ? Qt::Checked : Qt::Unchecked);
    ui.useStyles->setCheckState(m_tocInfo->m_useIndexSourceStyles ? Qt::Checked : Qt::Unchecked);

    connect(ui.lineEditTitle, SIGNAL(textChanged(QString)), this, SLOT(titleTextChanged(QString)));
    connect(ui.useOutline, SIGNAL(stateChanged(int)), this, SLOT(useOutline(int)));
    connect(ui.useStyles, SIGNAL(stateChanged(int)), this, SLOT(useIndexSourceStyles(int)));

    m_tocEntryStyleModel = new TableOfContentsEntryModel(KoTextDocument(m_textEditor->document()).styleManager(), m_tocInfo);
    connect(m_tocEntryStyleModel, SIGNAL(tocEntryDataChanged()), this, SLOT(updatePreview()));

    m_tocEntryConfigureDelegate = new TableOfContentsEntryDelegate(KoTextDocument(m_textEditor->document()).styleManager());

    ui.configureToCEntryStyle->setModel(m_tocEntryStyleModel);

    ui.configureToCEntryStyle->setItemDelegateForColumn(1, m_tocEntryConfigureDelegate);

    ui.configureToCEntryStyle->setShowGrid(false);
    ui.configureToCEntryStyle->verticalHeader()->hide();
    ui.configureToCEntryStyle->setEditTriggers(QAbstractItemView::CurrentChanged | QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);
    ui.configureToCEntryStyle->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui.configureToCEntryStyle->horizontalHeader()->setResizeMode(0, QHeaderView::ResizeToContents);
    ui.configureToCEntryStyle->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch);

    connect(this, SIGNAL(accepted()), this, SLOT(save()));
    connect(this, SIGNAL(rejected()), this, SLOT(cleanUp()));

    updatePreview();
}
KexiProjectTitleSelectionPage::KexiProjectTitleSelectionPage(QWidget* parent)
 : KexiAssistantPage(i18n("Project Title & Filename"),
                  i18n("Enter title for the new project. "
                       "Filename will be created automatically based on the title. "
                       "You can change the filename too."),
                  parent)
{
    setBackButtonVisible(true);
    setNextButtonVisible(true);
    contents = new KexiDBTitlePage(QString());
    contents->formLayout->setSpacing(KDialog::spacingHint());
    contents->le_title->setText(defaultDatabaseName());
    contents->le_title->selectAll();
    connect(contents->le_title, SIGNAL(textChanged(QString)),
            this, SLOT(titleTextChanged(QString)));
    fileHandler = new KexiStartupFileHandler(
        KUrl("kfiledialog:///OpenExistingOrCreateNewProject"),
        KexiStartupFileHandler::SavingFileBasedDB,
        contents->file_requester);
    connect(fileHandler, SIGNAL(askForOverwriting(KexiContextMessage)),
            this, SLOT(askForOverwriting(KexiContextMessage)));

    contents->file_requester->fileDialog()->setCaption(i18n("Save New Project As"));
    updateUrl();

    setContents(contents);
}
void InfoNotification::setTitleText(const QString &titleText)
{
    if (m_titleText != titleText) {
        m_titleText = titleText;

        emit titleTextChanged();
    }
}
Пример #4
0
void TableOfContentsConfigure::cleanUp()
{
    disconnect(ui.lineEditTitle, SIGNAL(textChanged(QString)), this, SLOT(titleTextChanged(QString)));
    disconnect(ui.useOutline, SIGNAL(stateChanged(int)), this, SLOT(useOutline(int)));
    disconnect(ui.useStyles, SIGNAL(stateChanged(int)), this, SLOT(useIndexSourceStyles(int)));

    disconnect(this, SIGNAL(accepted()), this, SLOT(save()));
    disconnect(this, SIGNAL(rejected()), this, SLOT(cleanUp()));

    if(m_tocEntryStyleModel) {
        delete m_tocEntryStyleModel;
        m_tocEntryStyleModel = 0;
    }

    if(m_tocEntryConfigureDelegate) {
        delete m_tocEntryConfigureDelegate;
        m_tocEntryConfigureDelegate = 0;
    }
}