FileListDialog::FileListDialog(QWidget* parent,
			       QString const& _dialogTitle,
			       QString const& _listTitle,
			       char const * _filters[]) :
  QDialog(parent, "FileListDialog", TRUE),       // TRUE = modal dialog
  list_(NULL),
  delButton_(NULL),
  fileDialog_(NULL),
  modified_(false)
{
  resize(300, 200);
  setCaption(_dialogTitle);

  Q3VBoxLayout * topBox = new Q3VBoxLayout(this, 0, -1, "boxLayout");

  Q3VGroupBox * fileBox = new Q3VGroupBox(this, "fileBox");
  list_ = new Q3ListBox(fileBox, "list");

  Q3HBox * fileButtonsBox = new Q3HBox(fileBox, "fileButtons");
  QPushButton * addButton = new QPushButton("Add...", fileButtonsBox);
  delButton_ = new QPushButton("Remove", fileButtonsBox);

  fileDialog_ = new Q3FileDialog(this, "config file dialog", TRUE);

  topBox->addSpacing(10);
  topBox->addWidget(fileBox);
  fileBox->setTitle(_listTitle);

  topBox->addSpacing(10);
  Q3HBoxLayout * dialogButtonsBox = new Q3HBoxLayout(topBox, -1, "hBoxLayout");
  QSpacerItem * dBSpace = new QSpacerItem(0, 0);
  QPushButton * okButton = new QPushButton("OK", this);
  QPushButton * cancelButton = new QPushButton("Cancel", this);
  
  topBox->addSpacing(5);
  dialogButtonsBox->addItem(dBSpace);
  dialogButtonsBox->addWidget(okButton);
  dialogButtonsBox->addSpacing(5);
  dialogButtonsBox->addWidget(cancelButton);
  dialogButtonsBox->addSpacing(5);
  
  okButton->setDefault(true);

  static const char * filters[3] = { "all files (*)", NULL };

  fileDialog_->setCaption("File open dialog");
  fileDialog_->setFilters((_filters == NULL)? filters : _filters);

  // connect the dialogs functionality  
  connect(okButton,     SIGNAL(clicked()), SLOT(accept()));
  connect(cancelButton, SIGNAL(clicked()), SLOT(reject()));
  connect(addButton,    SIGNAL(clicked()), SLOT(add()));
  connect(delButton_,   SIGNAL(clicked()), SLOT(del()));

  selectListItem();
}
Ejemplo n.º 2
0
void StocksDialog::createFundamentalsPage ()
{
    QWidget *w = new QWidget(this);

    Q3VBoxLayout *vbox = new Q3VBoxLayout(w);
    vbox->setMargin(5);
    vbox->setSpacing(5);

    Setting fund;
    QString s, s2;
    index->getFundamentals(symbol, s2);
    fund.parse(s2);

    s = tr("Fundamentals: last updated ");
    s2 = "updateDate";
    QString s3;
    fund.getData(s2, s3);
    s.append(s3);
    fund.remove(s2);
    QStringList key;
    fund.getKeyList(key);
    key.sort();

    vbox->addSpacing(10);
    QLabel *label = new QLabel(s, w);
    vbox->addWidget(label);

    fundView = new Q3ListView(w);
    fundView->addColumn(tr("Description"));
    fundView->addColumn(tr("Value"));
    vbox->addWidget(fundView);

    int loop;
    for (loop = 0; loop < (int) key.count(); loop++)
    {
        fund.getData(key[loop], s);
        new Q3ListViewItem(fundView, key[loop], s);
    }

    if (! key.count())
        new Q3ListViewItem(fundView, tr("No data available."));

    addTab(w, tr("Fundamentals"));
}
Ejemplo n.º 3
0
//===========================================================
//
void ImportWizard::setupFinish()
{
    m_finishPage = new QWidget(this);
    m_finishPage->hide();
    Q3VBoxLayout *vbox = new Q3VBoxLayout(m_finishPage, KDialog::marginHint());
    m_finishLbl = new QLabel(m_finishPage);
    m_finishLbl->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    m_finishLbl->setWordWrap(true);

    vbox->addWidget(m_finishLbl);
    m_openImportedProjectCheckBox = new QCheckBox(i18n("Open imported project"),
            m_finishPage);
    m_openImportedProjectCheckBox->setChecked(true);
    vbox->addSpacing(KDialog::spacingHint());
    vbox->addWidget(m_openImportedProjectCheckBox);
    vbox->addStretch(1);

    addPage(m_finishPage, i18n("Success"));
}