示例#1
0
WatchersDialog::WatchersDialog(KConfig& cfg, QWidget* parent, const char* name)
    : KDialogBase(parent, name, false, QString::null,
                  Close, ButtonCode(0), true)
    , partConfig(cfg)
{
    QFrame* mainWidget = makeMainWidget();

    QBoxLayout *layout = new QVBoxLayout(mainWidget, 0, spacingHint());

    table = new QTable(mainWidget, "watchersTable");
    table->setNumCols(5);
    table->setSelectionMode(QTable::NoSelection);
    table->setColumnMovingEnabled(false);
    table->setRowMovingEnabled(false);
    table->setReadOnly(true);
    table->setDragEnabled(false);
    table->setSorting(true);
    table->verticalHeader()->hide();
    table->setLeftMargin(0);
    
    QHeader* header = table->horizontalHeader();
    header->setLabel(0, i18n("File"));
    header->setLabel(1, i18n("Watcher"));
    header->setLabel(2, i18n("Edit"));
    header->setLabel(3, i18n("Unedit"));
    header->setLabel(4, i18n("Commit"));
    
    layout->addWidget(table, 1);

    setWFlags(Qt::WDestructiveClose | getWFlags());

    QSize size = configDialogSize(partConfig, "WatchersDialog");
    resize(size);
}
KSUpgradeManager::KSUpgradeManager(QWidget *parent, const QString &caption)
  : KDialogBase(parent, "KSDownloadManager", true, caption, Ok|Cancel), m_completedDownloads(0)
{
  KIO::CopyJob *copy;

  //Setting up the basics...
  setButtonText(ButtonCode(Ok), i18n("Upgrade"));
  setButtonText(ButtonCode(Cancel), i18n("Close"));
  enableButtonOK(false);

  m_mainWidget = new KSUpgradeManagerWdt(this);
  setMainWidget(m_mainWidget);
  m_mainWidget->downloadList->addColumn(i18n("File"));

  //Download versioning files...
  m_mainWidget->currentLabel->setText(i18n("Version files"));
  copy = KIO::copy(KURL("http://kslovar.berlios.de/version"), KURL("/tmp/version"), false);
  connect(copy, SIGNAL(result(KIO::Job*)), this, SLOT(slotCheckVersion()));
  connect(copy, SIGNAL(percent(KIO::Job*, unsigned long)), this, SLOT(slotProgress(KIO::Job*, unsigned long)));
  copy->setInteractive(false);
}