예제 #1
0
RecipeImportDialog::RecipeImportDialog( const RecipeList &list, QWidget *parent )
    : KDialog( parent ),
      list_copy( list )
{
    this->setObjectName( "RecipeImportDialog" );
    this->setModal( true );
    this->setCaption( i18nc( "@title:window", "Import Recipes" ) );
    this->setButtons( KDialog::Ok | KDialog::Cancel );
    this->setDefaultButton( KDialog::Ok );
    setButtonsOrientation( Qt::Vertical );

    KVBox *page = new KVBox( this );
    setMainWidget( page );


    kListView = new K3ListView( page );
    kListView->addColumn( i18nc( "@title:column", "Recipes" ) );
    kListView->setProperty( "selectionMode", "NoSelection" );
    kListView->setRootIsDecorated( true );
    kListView->setAllColumnsShowFocus( true );

    languageChange();

    setInitialSize( QSize( 600, 480 ).expandedTo( minimumSizeHint() ) );

    loadListView();
}
예제 #2
0
NamedAreaDialog::NamedAreaDialog(QWidget* parent, Selection* selection)
        : KDialog(parent)
        , m_selection(selection)
{
    setButtons(KDialog::Ok | KDialog::Close | KDialog::User1 | KDialog::User2 | KDialog::User3);
    setButtonsOrientation(Qt::Vertical);
    setButtonText(KDialog::Ok, i18n("&Select"));
    setButtonText(KDialog::User1, i18n("&Remove"));
    setButtonText(KDialog::User2, i18n("&Edit..."));
    setButtonText(KDialog::User3, i18n("&New..."));
    setCaption(i18n("Named Areas"));
    setModal(true);
    setObjectName("NamedAreaDialog");

    QWidget* widget = new QWidget(this);
    setMainWidget(widget);

    QVBoxLayout *vboxLayout = new QVBoxLayout(widget);
    vboxLayout->setMargin(0);
    vboxLayout->setSpacing(KDialog::spacingHint());

    m_list = new KListWidget(this);
    m_list->setSortingEnabled(true);
    vboxLayout->addWidget(m_list);

    m_rangeName = new QLabel(this);
    m_rangeName->setText(i18n("Area: %1", QString()));
    vboxLayout->addWidget(m_rangeName);

    const QList<QString> namedAreas = m_selection->activeSheet()->map()->namedAreaManager()->areaNames();
    for (int i = 0; i < namedAreas.count(); ++i)
        m_list->addItem(namedAreas[i]);

    if (m_list->count() == 0) {
        enableButtonOk(false);
        enableButton(KDialog::User1, false);
        enableButton(KDialog::User2, false);
        m_list->setCurrentRow(0);
    }

    connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
    connect(this, SIGNAL(cancelClicked()), this, SLOT(slotClose()));
    connect(this, SIGNAL(user1Clicked()), this, SLOT(slotRemove()));
    connect(this, SIGNAL(user2Clicked()), this, SLOT(slotEdit()));
    connect(this, SIGNAL(user3Clicked()), this, SLOT(slotNew()));
    connect(m_list, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(slotOk()));
    connect(m_list, SIGNAL(currentTextChanged(const QString&)),
            this, SLOT(displayAreaValues(const QString&)));

    if (m_list->count() > 0)
        m_list->setCurrentItem(m_list->item(0));

    m_list->setFocus();
}
예제 #3
0
/**
 * ConditionalDialog
 * Sets conditional cell formattings.
 */
ConditionalDialog::ConditionalDialog(QWidget* parent, Selection* selection)
        : KDialog(parent),
        m_selection(selection),
        m_dlg(new ConditionalWidget(this))
{
    setButtons(KDialog::Ok | KDialog::Cancel);
    setCaption(i18n("Conditional Styles"));

    QStringList list(m_selection->activeSheet()->map()->styleManager()->styleNames());

    m_dlg->m_style_1->insertItems(0, list);
    m_dlg->m_style_2->insertItems(0, list);
    m_dlg->m_style_3->insertItems(0, list);

    setButtonsOrientation(Qt::Vertical);
    setMainWidget(m_dlg);

    connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));

    init();
}