Пример #1
0
AddressBook::AddressBook(MainWindow* main)
    : ActiveList(main, "AddressBook", true)
{
    _helpSource = "address_book.html";

    // Columns for all tab
    _list->addTextColumn(tr("Name"), 30);
    _list->addTextColumn(tr("Number"), 12);
    _list->addTextColumn(tr("Phone Number"), 20);
    _list->addTextColumn(tr("Type"), 14);
    _list->setSorting(0);

    // Catch changing tabs so can disable buttons
    connect(_tabs, SIGNAL(currentChanged(QWidget*)),
	    SLOT(tabChanged(QWidget*)));

    // List for customers tab
    if (_quasar->securityCheck("CustomerMaster", "View")) {
	_customer = new ListView(_tabs);
	_tabs->addTab(_customer, tr("&Customers"));
	_customer->setAllColumnsShowFocus(true);
	_customer->setRootIsDecorated(false);
	_customer->setShowSortIndicator(true);
	_customer->addTextColumn(tr("Name"), 30);
	_customer->addTextColumn(tr("Number"), 12);
	_customer->addTextColumn(tr("Phone Number"), 20);
	_customer->addMoneyColumn(tr("Balance"));
	_customer->setSorting(0);
	connectList(_customer);
    } else {
	_customer = NULL;
    }

    // List for vendors tab
    if (_quasar->securityCheck("VendorMaster", "View")) {
	_vendor = new ListView(_tabs);
	_tabs->addTab(_vendor, tr("&Vendors"));
	_vendor->setAllColumnsShowFocus(true);
	_vendor->setRootIsDecorated(false);
	_vendor->setShowSortIndicator(true);
	_vendor->addTextColumn(tr("Name"), 30);
	_vendor->addTextColumn(tr("Number"), 12);
	_vendor->addTextColumn(tr("Phone Number"), 20);
	_vendor->addMoneyColumn(tr("Balance"));
	_vendor->setSorting(0);
	connectList(_vendor);
    } else {
	_vendor = NULL;
    }

    // List for employees tab
    if (_quasar->securityCheck("EmployeeMaster", "View")) {
	_employee = new ListView(_tabs);
	_tabs->addTab(_employee, tr("&Employees"));
	_employee->setAllColumnsShowFocus(true);
	_employee->setRootIsDecorated(false);
	_employee->setShowSortIndicator(true);
	_employee->addTextColumn(tr("Name"), 30);
	_employee->addTextColumn(tr("Number"), 12);
	_employee->addTextColumn(tr("Phone Number"), 20);
	_employee->setSorting(0);
	connectList(_employee);
    } else {
	_employee = NULL;
    }

    // List for personal tab
    if (_quasar->securityCheck("PersonalMaster", "View")) {
	_personal = new ListView(_tabs);
	_tabs->addTab(_personal, tr("&Personal"));
	_personal->setAllColumnsShowFocus(true);
	_personal->setRootIsDecorated(false);
	_personal->setShowSortIndicator(true);
	_personal->addTextColumn(tr("Name"), 30);
	_personal->addTextColumn(tr("Phone Number"), 20);
	_personal->setSorting(0);
	connectList(_personal);
    } else {
	_personal = NULL;
    }

    QLabel* nameLabel = new QLabel(tr("Name:"), _search);
    _name = new LineEdit(_search);
    _name->setLength(40);
    connect(_name, SIGNAL(returnPressed()), SLOT(slotRefresh()));

    QLabel* numberLabel = new QLabel(tr("Number:"), _search);
    _number = new LineEdit(_search);
    _number->setLength(12);
    connect(_number, SIGNAL(returnPressed()), SLOT(slotRefresh()));

    QLabel* groupLabel = new QLabel(tr("Group:"), _search);
    _groupLookup = new GroupLookup(_main, this, -1);
    _group = new LookupEdit(_groupLookup, _search);
    _group->setLength(15);
    groupLabel->setBuddy(_group);

    QLabel* storeLabel = new QLabel(tr("Store:"), _search);
    _store = new LookupEdit(new StoreLookup(main, this), _search);
    _store->setLength(30);

    QGridLayout* grid = new QGridLayout(_search);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(2, 1);
    grid->addWidget(nameLabel, 0, 0);
    grid->addWidget(_name, 0, 1, AlignLeft | AlignVCenter);
    grid->addWidget(numberLabel, 1, 0);
    grid->addWidget(_number, 1, 1, AlignLeft | AlignVCenter);
    grid->addWidget(groupLabel, 2, 0);
    grid->addWidget(_group, 2, 1, AlignLeft | AlignVCenter);
    grid->addWidget(storeLabel, 3, 0);
    grid->addWidget(_store, 3, 1, AlignLeft | AlignVCenter);

    if (_quasar->storeCount() == 1) {
	storeLabel->hide();
	_store->hide();
    }

    setCaption(tr("Address Book"));
    finalize(false);
    _name->setFocus();
}
Пример #2
0
BankDeposit::BankDeposit(MainWindow* main)
    : QuasarWindow(main, "BankDeposit")
{
    _helpSource = "bank_deposit.html";

    _quasar->db()->lookup(_company);

    QFrame* frame = new QFrame(this);

    QLabel* safeStoreLabel = new QLabel(tr("Safe Store:"), frame);
    _safeStore = new LookupEdit(new StoreLookup(main, this), frame);
    _safeStore->setLength(30);
    safeStoreLabel->setBuddy(_safeStore);

    QLabel* safeIdLabel;
    if (_company.shiftMethod() == Company::BY_STATION) {
	safeIdLabel = new QLabel(tr("Safe Station:"), frame);
	_safeId = new LookupEdit(new StationLookup(main, this), frame);
    } else {
	safeIdLabel = new QLabel(tr("Safe Employee:"), frame);
	_safeId = new LookupEdit(new EmployeeLookup(main, this), frame);
    }
    _safeId->setLength(30);
    safeIdLabel->setBuddy(_safeId);

    _tenders = new Table(frame);
    _tenders->setVScrollBarMode(QScrollView::AlwaysOn);
    _tenders->setLeftMargin(fontMetrics().width("99999"));
    _tenders->setDisplayRows(10);
    connect(_tenders, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(cellChanged(int,int,Variant)));
    connect(_tenders, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(focusNext(bool&,int&,int&,int)));
    connect(_tenders, SIGNAL(rowDeleted(int)), SLOT(recalculate()));

    // Add columns
    new TextColumn(_tenders, tr("Tender"), 30);
    new MoneyColumn(_tenders, tr("In Safe"), 10);
    new MoneyColumn(_tenders, tr("Amount"), 10);

    // Add editors
    new NumberEditor(_tenders, 2, new MoneyEdit(_tenders));

    QLabel* totalLabel = new QLabel(tr("Tender Total:"), frame);
    _total = new MoneyEdit(frame);
    _total->setFocusPolicy(NoFocus);

    QFrame* buttons = new QFrame(frame);

    QPushButton* refresh = new QPushButton(tr("&Refresh"), buttons);
    connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh()));

    QPushButton* all = new QPushButton(tr("Deposit All"), buttons);
    connect(all, SIGNAL(clicked()), SLOT(slotAll()));

    QPushButton* ok = new QPushButton(tr("&OK"), buttons);
    connect(ok, SIGNAL(clicked()), SLOT(slotOk()));

    QPushButton* cancel = new QPushButton(tr("&Cancel"), buttons);
    connect(cancel, SIGNAL(clicked()), SLOT(close()));

    ok->setMinimumSize(cancel->sizeHint());
    cancel->setMinimumSize(cancel->sizeHint());

    QGridLayout* buttonsGrid = new QGridLayout(buttons);
    buttonsGrid->setSpacing(6);
    buttonsGrid->setMargin(6);
    buttonsGrid->setColStretch(2, 1);
    buttonsGrid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter);
    buttonsGrid->addWidget(all, 0, 1, AlignLeft | AlignVCenter);
    buttonsGrid->addWidget(cancel, 0, 2, AlignRight | AlignVCenter);
    buttonsGrid->addWidget(ok, 0, 3, AlignRight | AlignVCenter);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->setRowStretch(2, 1);
    grid->setColStretch(1, 1);
    grid->addWidget(safeStoreLabel, 0, 0);
    grid->addWidget(_safeStore, 0, 1, AlignLeft | AlignVCenter);
    grid->addWidget(safeIdLabel, 1, 0);
    grid->addWidget(_safeId, 1, 1, AlignLeft | AlignVCenter);
    grid->addMultiCellWidget(_tenders, 2, 2, 0, 2);
    grid->addMultiCellWidget(totalLabel, 3, 3, 0, 1, AlignRight|AlignVCenter);
    grid->addWidget(_total, 3, 2, AlignLeft | AlignVCenter);
    grid->addMultiCellWidget(buttons, 4, 4, 0, 2);

    _safeStore->setId(_company.safeStore());
    if (_company.shiftMethod() == Company::BY_STATION)
	_safeId->setId(_company.safeStation());
    else
	_safeId->setId(_company.safeEmployee());

    TenderSelect conditions;
    conditions.activeOnly = true;
    conditions.bankOnly = true;
    _quasar->db()->select(_tenderList, conditions);
    std::sort(_tenderList.begin(), _tenderList.end());

    unsigned int i;
    for (i = 0; i < _tenderList.size(); ++i) {
	VectorRow* row = new VectorRow(_tenders->columns());
	row->setValue(0, _tenderList[i].name());
	row->setValue(1, "");
	row->setValue(2, "");
	_tenders->appendRow(row);
    }
    _tenders->setCurrentCell(0, 2);
    qApp->processEvents();
    _tenders->verticalScrollBar()->setValue(0);
    _date = QDate::currentDate();
    _tenders->setFocus();

    slotRefresh();

    setCentralWidget(frame);
    setCaption(tr("Bank Deposit"));
    finalize();
}
Пример #3
0
OpenBalances::OpenBalances(MainWindow* main)
    : QuasarWindow(main, "OpenBalances")
{
    _helpSource = "open_balances.html";

    QFrame* frame = new QFrame(this);
    QFrame* top = new QFrame(frame);

    QLabel* storeLabel = new QLabel(tr("Store:"), top);
    _store = new LookupEdit(new StoreLookup(main, this), top);
    _store->setLength(30);
    storeLabel->setBuddy(_store);
    connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged()));

    QLabel* stationLabel = new QLabel(tr("Station:"), top);
    _station = new LookupEdit(new StationLookup(main, this), top);
    _station->setLength(30);
    stationLabel->setBuddy(_station);

    QLabel* employeeLabel = new QLabel(tr("Employee:"), top);
    _employee = new LookupEdit(new EmployeeLookup(main, this), top);
    _employee->setLength(30);
    employeeLabel->setBuddy(_employee);

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setSpacing(6);
    topGrid->setMargin(3);
    topGrid->setColStretch(2, 1);
    topGrid->addWidget(storeLabel, 0, 0);
    topGrid->addWidget(_store, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(stationLabel, 1, 0);
    topGrid->addWidget(_station, 1, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(employeeLabel, 2, 0);
    topGrid->addWidget(_employee, 2, 1, AlignLeft | AlignVCenter);

    QTabWidget* tabs = new QTabWidget(frame);
    QFrame* customers = new QFrame(tabs);
    QFrame* vendors = new QFrame(tabs);
    QFrame* items = new QFrame(tabs);
    QFrame* accounts = new QFrame(tabs);
    tabs->addTab(customers, tr("Customers"));
    tabs->addTab(vendors, tr("Vendors"));
    tabs->addTab(items, tr("Items"));
    tabs->addTab(accounts, tr("Accounts"));

    _customers = new Table(customers);
    _customers->setVScrollBarMode(QScrollView::AlwaysOn);
    _customers->setDisplayRows(10);
    _customers->setLeftMargin(fontMetrics().width("99999"));
    connect(_customers, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(customerCellChanged(int,int,Variant)));
    connect(_customers, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(customerFocusNext(bool&,int&,int&,int)));

    CustomerLookup* custLookup = new CustomerLookup(_main, this);

    new LookupColumn(_customers, tr("Customer"), 30, custLookup);
    new DateColumn(_customers, tr("Date"));
    new MoneyColumn(_customers, tr("Amount"), 10);

    new LookupEditor(_customers, 0, new LookupEdit(custLookup, _customers));
    new LineEditor(_customers, 1, new DateEdit(_customers));
    new NumberEditor(_customers, 2, new MoneyEdit(_customers));

    QGridLayout* customerGrid = new QGridLayout(customers);
    customerGrid->setSpacing(6);
    customerGrid->setMargin(3);
    customerGrid->setColStretch(0, 1);
    customerGrid->addWidget(_customers, 0, 0);

    _vendors = new Table(vendors);
    _vendors->setVScrollBarMode(QScrollView::AlwaysOn);
    _vendors->setDisplayRows(10);
    _vendors->setLeftMargin(fontMetrics().width("99999"));
    connect(_vendors, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(vendorCellChanged(int,int,Variant)));
    connect(_vendors, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(vendorFocusNext(bool&,int&,int&,int)));

    VendorLookup* vendLookup = new VendorLookup(_main, this);

    new LookupColumn(_vendors, tr("Vendor"), 30, vendLookup);
    new DateColumn(_vendors, tr("Date"));
    new MoneyColumn(_vendors, tr("Amount"), 10);

    new LookupEditor(_vendors, 0, new LookupEdit(vendLookup, _vendors));
    new LineEditor(_vendors, 1, new DateEdit(_vendors));
    new NumberEditor(_vendors, 2, new MoneyEdit(_vendors));

    QGridLayout* vendorGrid = new QGridLayout(vendors);
    vendorGrid->setSpacing(6);
    vendorGrid->setMargin(3);
    vendorGrid->setColStretch(0, 1);
    vendorGrid->addWidget(_vendors, 0, 0);

    _items = new Table(items);
    _items->setVScrollBarMode(QScrollView::AlwaysOn);
    _items->setDisplayRows(10);
    _items->setLeftMargin(fontMetrics().width("99999"));
    connect(_items, SIGNAL(cellMoved(int,int)), SLOT(itemCellMoved(int,int)));
    connect(_items, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(itemCellChanged(int,int,Variant)));
    connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(itemFocusNext(bool&,int&,int&,int)));

    _itemLookup = new ItemLookup(_main, this);
    _itemLookup->inventoriedOnly = true;

    new LookupColumn(_items, tr("Item"), 12, _itemLookup);
    new TextColumn(_items, tr("Description"), 20);
    new TextColumn(_items, tr("Size"), 8);
    new NumberColumn(_items, tr("Quantity"), 6);
    new MoneyColumn(_items, tr("Total Cost"), 8);

    _size = new QComboBox(_items);
    new LookupEditor(_items, 0, new ItemEdit(_itemLookup, _items));
    new ComboEditor(_items, 2, _size);
    new NumberEditor(_items, 3, new DoubleEdit(_items));
    new NumberEditor(_items, 4, new MoneyEdit(_items));

    QGridLayout* itemGrid = new QGridLayout(items);
    itemGrid->setSpacing(6);
    itemGrid->setMargin(3);
    itemGrid->setColStretch(0, 1);
    itemGrid->addWidget(_items, 0, 0);

    _accounts = new Table(accounts);
    _accounts->setVScrollBarMode(QScrollView::AlwaysOn);
    _accounts->setDisplayRows(10);
    _accounts->setLeftMargin(fontMetrics().width("99999"));
    connect(_accounts, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(accountCellChanged(int,int,Variant)));
    connect(_accounts, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(accountFocusNext(bool&,int&,int&,int)));

    AccountLookup* acctLookup = new AccountLookup(_main, this);

    new LookupColumn(_accounts, tr("Account"), 30, acctLookup);
    new MoneyColumn(_accounts, tr("Debit"), 10);
    new MoneyColumn(_accounts, tr("Credit"), 10);

    new LookupEditor(_accounts, 0, new LookupEdit(acctLookup, _accounts));
    new NumberEditor(_accounts, 1, new MoneyEdit(_accounts));
    new NumberEditor(_accounts, 2, new MoneyEdit(_accounts));

    QGridLayout* accountGrid = new QGridLayout(accounts);
    accountGrid->setSpacing(6);
    accountGrid->setMargin(3);
    accountGrid->setColStretch(0, 1);
    accountGrid->addWidget(_accounts, 0, 0);

    QFrame* bot = new QFrame(frame);

    QLabel* accountLabel = new QLabel(tr("Account:"), bot);
    _account = new LookupEdit(new AccountLookup(_main, this), bot);
    _account->setLength(30);
    accountLabel->setBuddy(_account);

    QLabel* totalLabel = new QLabel(tr("Total:"), bot);
    _total = new MoneyEdit(bot);
    _total->setFocusPolicy(NoFocus);
    totalLabel->setBuddy(_total);

    QGridLayout* botGrid = new QGridLayout(bot);
    botGrid->setSpacing(6);
    botGrid->setMargin(3);
    botGrid->setColStretch(2, 1);
    botGrid->addWidget(accountLabel, 0, 0);
    botGrid->addWidget(_account, 0, 1, AlignLeft | AlignVCenter);
    botGrid->addWidget(totalLabel, 0, 3);
    botGrid->addWidget(_total, 0, 4, AlignLeft | AlignVCenter);

    QFrame* buttons = new QFrame(frame);
    QPushButton* import = new QPushButton(tr("Import"), buttons);
    QPushButton* post = new QPushButton(tr("Post"), buttons);
    QPushButton* cancel = new QPushButton(tr("Cancel"), buttons);

    connect(import, SIGNAL(clicked()), SLOT(slotImport()));
    connect(post, SIGNAL(clicked()), SLOT(slotPost()));
    connect(cancel, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(6);
    buttonGrid->setMargin(3);
    buttonGrid->setColStretch(1, 1);
    buttonGrid->addWidget(import, 0, 0);
    buttonGrid->addWidget(post, 0, 2);
    buttonGrid->addWidget(cancel, 0, 3);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(3);
    grid->addWidget(top, 0, 0);
    grid->addWidget(tabs, 1, 0);
    grid->addWidget(bot, 2, 0);
    grid->addWidget(buttons, 3, 0);

    Company company;
    _quasar->db()->lookup(company);

    _store->setId(_quasar->defaultStore(true));
    _station->setId(_quasar->defaultStation());
    _employee->setId(_quasar->defaultEmployee());
    _account->setId(company.historicalBalancing());

    _customers->appendRow(new VectorRow(_customers->columns()));
    _vendors->appendRow(new VectorRow(_vendors->columns()));
    _items->appendRow(new VectorRow(_items->columns()));
    _accounts->appendRow(new VectorRow(_accounts->columns()));

#if 0
    ItemSelect conditions;
    vector<Item> v_items;
    _quasar->db()->select(v_items, conditions);
    for (unsigned int i = 0; i < v_items.size(); ++i) {
	Item& item = v_items[i];
	for (unsigned int j = 0; j < item.vendors().size(); ++j) {
	    ItemVendor& vendor = item.vendors()[j];

	    bool found = false;
	    for (unsigned int k = 0; k < item.numbers().size(); ++k) {
		if (item.numbers()[k].number == vendor.number) {
		    found = true;
		    break;
		}
	    }
	    if (found) continue;

	    ItemPlu info;
	    info.number = vendor.number;

	    Item orig = item;
	    item.numbers().push_back(info);
	    _quasar->db()->update(orig, item);
	}
    }
#endif

    setCentralWidget(frame);
    setCaption(tr("Open Balances"));
    finalize();
}
Пример #4
0
SequenceNumber::SequenceNumber(MainWindow* main)
    : QuasarWindow(main, "SequenceNumber")
{
    _helpSource = "seq_number.html";

    QFrame* frame = new QFrame(this);
    QScrollView* sv = new QScrollView(frame);
    _nums = new QButtonGroup(4, Horizontal, tr("Seq Numbers"), sv->viewport());

    new QLabel("Type", _nums);
    new QLabel("Minimum", _nums);
    new QLabel("Maximum", _nums);
    new QLabel("Next", _nums);

    addIdEdit(tr("Data Object:"), "data_object", "object_id");
    addIdEdit(tr("Journal Entry:"), "gltx", "Journal Entry");
    addIdEdit(tr("Ledger Transfer:"), "gltx", "Ledger Transfer");
    addIdEdit(tr("Card Adjustment:"), "gltx", "Card Adjustment");
    addIdEdit(tr("Customer Invoice:"), "gltx", "Customer Invoice");
    addIdEdit(tr("Customer Return:"), "gltx", "Customer Return");
    addIdEdit(tr("Customer Payment:"), "gltx", "Customer Payment");
    addIdEdit(tr("Customer Quote:"), "quote", "number");
    addIdEdit(tr("Vendor Invoice:"), "gltx", "Vendor Invoice");
    addIdEdit(tr("Vendor Claim:"), "gltx", "Vendor Claim");
    addIdEdit(tr("Purchase Order:"), "porder", "number");
    addIdEdit(tr("Packing Slip:"), "slip", "number");
    addIdEdit(tr("Nosale:"), "gltx", "Nosale");
    addIdEdit(tr("Payout:"), "gltx", "Payout");
    addIdEdit(tr("Withdraw:"), "gltx", "Withdraw");
    addIdEdit(tr("Shift:"), "gltx", "Shift");
    addIdEdit(tr("Item Adjustment:"), "gltx", "Item Adjustment");
    addIdEdit(tr("Item Transfer:"), "gltx", "Item Transfer");
    addIdEdit(tr("Physical Count:"), "pcount", "number");
    addIdEdit(tr("Label Batch:"), "label_batch", "number");
    addIdEdit(tr("Price Batch:"), "price_batch", "number");
    addIdEdit(tr("Promo Batch:"), "promo_batch", "number");
    addIdEdit(tr("Company Number:"), "company", "number");
    addIdEdit(tr("Store Number:"), "store", "number");
    addIdEdit(tr("Station Number:"), "station", "number");
    addIdEdit(tr("Tender Count #:"), "tender_count", "number");
    addIdEdit(tr("Tender Menu #:"), "tender", "menu_num");

    QFrame* buttons = new QFrame(frame);
    QPushButton* ok = new QPushButton(tr("&OK"), buttons);
    QPushButton* quit = new QPushButton(tr("&Close"), buttons);

    connect(ok, SIGNAL(clicked()), SLOT(slotOk()));
    connect(quit, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(3);
    buttonGrid->setMargin(3);
    buttonGrid->setColStretch(0, 1);
    buttonGrid->addWidget(ok, 0, 1);
    buttonGrid->addWidget(quit, 0, 2);

    _nums->resize(_nums->sizeHint());
    sv->setVScrollBarMode(QScrollView::AlwaysOn);
    sv->resizeContents(_nums->width() + 20, _nums->height());

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->setRowStretch(0, 1);
    grid->addWidget(sv, 0, 0);
    grid->addWidget(buttons, 1, 0);

    for (unsigned int i = 0; i < _ids.size(); ++i) {
	IdInfo& info = _ids[i];
	_quasar->db()->getSequence(info.seq);
	info.minNum->setFixed(info.seq.minNumber());
	info.maxNum->setFixed(info.seq.maxNumber());
	info.nextNum->setFixed(info.seq.nextNumber());
    }

    statusBar()->hide();
    setCentralWidget(frame);
    setCaption(tr("Sequence Numbers"));
    finalize();

    if (!allowed("View")) {
	QTimer::singleShot(50, this, SLOT(slotNotAllowed()));
	return;
    }
}
Пример #5
0
QWidget* CombatWindow::initDefenseWidget()
{
	QGridLayout* avoidanceLayout = new QGridLayout();

	// Misses
	avoidanceLayout->addWidget(new QLabel("Misses:"), 0, 0);
	m_defenseAvoidMisses = new QLabel();
	avoidanceLayout->addWidget(m_defenseAvoidMisses, 0, 1);

	// Blocks
	avoidanceLayout->addWidget(new QLabel("Blocks:"), 0, 2);
	m_defenseAvoidBlock = new QLabel();
	avoidanceLayout->addWidget(m_defenseAvoidBlock, 0, 3);

	// Parries
	avoidanceLayout->addWidget(new QLabel("Parries:"), 0, 4);
	m_defenseAvoidParry = new QLabel();
	avoidanceLayout->addWidget(m_defenseAvoidParry, 0, 5);

	// Ripostes
	avoidanceLayout->addWidget(new QLabel("Ripostes:"), 1, 0);
	m_defenseAvoidRiposte = new QLabel();
	avoidanceLayout->addWidget(m_defenseAvoidRiposte, 1, 1);

	// Dodges
	avoidanceLayout->addWidget(new QLabel("Dodges"), 1, 2);
	m_defenseAvoidDodge = new QLabel();
	avoidanceLayout->addWidget(m_defenseAvoidDodge, 1, 3);

	// Total
	avoidanceLayout->addWidget(new QLabel("Total:"), 1, 4);
	m_defenseAvoidTotal = new QLabel();
	avoidanceLayout->addWidget(m_defenseAvoidTotal, 1, 5);

	avoidanceLayout->setColStretch(1, 1);
	avoidanceLayout->setColStretch(3, 1);
	avoidanceLayout->setColStretch(5, 1);
	avoidanceLayout->setSpacing(5);

	QGroupBox* avoidanceBox = new QGroupBox("Avoidance");
	avoidanceBox->setLayout(avoidanceLayout);


	QGridLayout* mitigationLayout = new QGridLayout();

	// Avg Hit
	mitigationLayout->addWidget(new QLabel("Avg. Hit:"), 0, 0);
	m_defenseMitigateAvgHit = new QLabel();
	mitigationLayout->addWidget(m_defenseMitigateAvgHit, 0, 1);

	// Min Hit:
	mitigationLayout->addWidget(new QLabel("Min Hit:"), 0, 2);
	m_defenseMitigateMinHit = new QLabel();
	mitigationLayout->addWidget(m_defenseMitigateMinHit, 0, 3);

	// Max Hit:
	mitigationLayout->addWidget(new QLabel("Max Hit:"), 0, 4);
	m_defenseMitigateMaxHit = new QLabel();
	mitigationLayout->addWidget(m_defenseMitigateMaxHit, 0, 5);

	mitigationLayout->setColStretch(1, 1);
	mitigationLayout->setColStretch(3, 1);
	mitigationLayout->setColStretch(5, 1);
	mitigationLayout->setSpacing(5);

	QGroupBox* mitigationBox = new QGroupBox("Mitigation");
	mitigationBox->setLayout(mitigationLayout);

	QGridLayout* summaryLayout = new QGridLayout();

	// Mob Attacks
	summaryLayout->addWidget(new QLabel("Mob Attacks:"), 0, 0);
	m_defenseMobAttacks = new QLabel();
	summaryLayout->addWidget(m_defenseMobAttacks, 0, 1);

	// Percent Avoided
	summaryLayout->addWidget(new QLabel("% Avoided:"), 0, 2);
	m_defensePercentAvoided = new QLabel();
	summaryLayout->addWidget(m_defensePercentAvoided, 0, 3);

	// Total damage
	summaryLayout->addWidget(new QLabel("Total Damage:"), 0, 4);
	m_defenseTotalDamage = new QLabel();
	summaryLayout->addWidget(m_defenseTotalDamage, 0, 5);

	summaryLayout->setColStretch(1, 1);
	summaryLayout->setColStretch(3, 1);
	summaryLayout->setColStretch(5, 1);
	summaryLayout->setSpacing(5);

	QGroupBox* summaryBox = new QGroupBox("Summary");
	summaryBox->setLayout(summaryLayout);

	m_defenseLayout = new QVBoxLayout();
	m_defenseLayout->addWidget(avoidanceBox);
	m_defenseLayout->addWidget(mitigationBox);
	m_defenseLayout->addWidget(summaryBox);

	QWidget* layoutWidget = new QWidget();
	layoutWidget->setLayout(m_defenseLayout);
	return layoutWidget;
}
Пример #6
0
//CT 21Oct1998 - rewritten for using layouts
KDesktopConfig::KDesktopConfig (QWidget * parent, const char *name)
  : KConfigWidget (parent, name)
{

  QBoxLayout *lay = new QVBoxLayout(this, 5);

  ElectricBox = new QButtonGroup(klocale->translate("Active desktop borders"),
				 this);

  QGridLayout *eLay = new QGridLayout(ElectricBox,5,3,10,5);
  eLay->addRowSpacing(0,10);
  eLay->setColStretch(0,0);
  eLay->setColStretch(1,1);

  enable= new
    QCheckBox(klocale->translate("Enable active desktop borders"),
	      ElectricBox);
  enable->adjustSize();
  enable->setMinimumSize(enable->size());
  eLay->addMultiCellWidget(enable,1,1,0,1);

  movepointer = new
    QCheckBox(klocale->translate("Move pointer towards center after switch"),
	      ElectricBox);
  movepointer->adjustSize();
  movepointer->setMinimumSize(movepointer->size());
  eLay->addMultiCellWidget(movepointer,2,2,0,1);

  delaylabel = new QLabel(klocale->translate("Desktop switch delay:"),
			  ElectricBox);
  delaylabel->adjustSize();
  delaylabel->setMinimumSize(delaylabel->size());
  delaylabel->setAlignment(AlignVCenter|AlignLeft);
  eLay->addWidget(delaylabel,3,0);

  delaylcd = new QLCDNumber (2, ElectricBox);
  delaylcd->setFrameStyle( QFrame::NoFrame );
  delaylcd->setFixedHeight(30);
  delaylcd->adjustSize();
  delaylcd->setMinimumSize(delaylcd->size());
  eLay->addWidget(delaylcd,3,1);

  delayslider = new KSlider(0,MAX_EDGE_RES/10,10,0,
			    KSlider::Horizontal, ElectricBox);
  delayslider->setSteps(10,10);
  delayslider->adjustSize();
  delayslider->setMinimumSize(delaylabel->width(), delayslider->height());
  eLay->addMultiCellWidget(delayslider,4,4,1,2);

  connect( delayslider, SIGNAL(valueChanged(int)), delaylcd, SLOT(display(int)) );

  connect( enable, SIGNAL(clicked()), this, SLOT(setEBorders()));

  eLay->activate();

  lay->addWidget(ElectricBox,5);

  //CT 15mar98 - add EdgeResistance, BorderAttractor, WindowsAttractor config
  MagicBox = new QButtonGroup(klocale->translate("Magic Borders"), this);

  eLay = new QGridLayout(MagicBox,4,3,10,5);
  eLay->addRowSpacing(0,10);
  eLay->addRowSpacing(2,10);
  eLay->setColStretch(0,0);
  eLay->setColStretch(1,0);
  eLay->setColStretch(2,1);

  BrdrSnapLabel = new QLabel(klocale->translate("Border Snap Zone:\n       (pixels)"), MagicBox);
  BrdrSnapLabel->adjustSize();
  BrdrSnapLabel->setMinimumSize(BrdrSnapLabel->size());
  BrdrSnapLabel->setAlignment(AlignTop);
  eLay->addWidget(BrdrSnapLabel,1,0);

  BrdrSnapLCD = new QLCDNumber (2, MagicBox);
  BrdrSnapLCD->setFrameStyle( QFrame::NoFrame );
  BrdrSnapLCD->setFixedHeight(30);
  BrdrSnapLCD->adjustSize();
  BrdrSnapLCD->setMinimumSize(BrdrSnapLCD->size());
  eLay->addWidget(BrdrSnapLCD,1,1);

  BrdrSnapSlider = new KSlider(0,MAX_BRDR_SNAP,1,0,
			       KSlider::Horizontal, MagicBox);
  BrdrSnapSlider->setSteps(1,1);
  BrdrSnapSlider->adjustSize();
  BrdrSnapSlider->setMinimumSize( BrdrSnapLabel->width()+
				  BrdrSnapLCD->width(),
				  BrdrSnapSlider->height());
  eLay->addWidget(BrdrSnapSlider,1,2);
  eLay->addRowSpacing(0,5);

  connect( BrdrSnapSlider, SIGNAL(valueChanged(int)), BrdrSnapLCD, SLOT(display(int)) );

  WndwSnapLabel = new QLabel(klocale->translate("Window Snap Zone:\n       (pixels)"), MagicBox);
  WndwSnapLabel->adjustSize();
  WndwSnapLabel->setMinimumSize(WndwSnapLabel->size());
  WndwSnapLabel->setAlignment(AlignTop);
  eLay->addWidget(WndwSnapLabel,3,0);

  WndwSnapLCD = new QLCDNumber (2, MagicBox);
  WndwSnapLCD->setFrameStyle( QFrame::NoFrame );
  WndwSnapLCD->setFixedHeight(30);
  WndwSnapLCD->adjustSize();
  WndwSnapLCD->setMinimumSize(WndwSnapLCD->size());
  eLay->addWidget(WndwSnapLCD,3,1);

  WndwSnapSlider = new KSlider(0,MAX_WNDW_SNAP,1,0,
			       KSlider::Horizontal, MagicBox);
  WndwSnapSlider->setSteps(1,1);
  WndwSnapSlider->adjustSize();
  WndwSnapSlider->setMinimumSize( WndwSnapLabel->width()+
				  WndwSnapLCD->width(),
				  WndwSnapSlider->height());
  eLay->addWidget(WndwSnapSlider,3,2);

  connect( WndwSnapSlider, SIGNAL(valueChanged(int)), WndwSnapLCD, SLOT(display(int)) );

  eLay->activate();

  lay->addWidget(MagicBox,5);

  lay->activate();

  GetSettings();
}
Пример #7
0
DictApplet::DictApplet(const QString& configFile, Type type, int actions, QWidget *parent, const char *name)
  : KPanelApplet(configFile, type, actions, parent, name), waiting(0)
{
  // first the widgets for a horizontal panel
  baseWidget = new QWidget(this);
  QGridLayout *baseLay = new QGridLayout(baseWidget,2,6,0,1);

  textLabel = new QLabel(i18n("Dictionary:"), baseWidget);
  textLabel->setBackgroundOrigin(AncestorOrigin);
  QFont f(textLabel->font());
  f.setPixelSize(12);
  textLabel->setFont(f);
  baseLay->addWidget(textLabel,0,1);
  QToolTip::add(textLabel,i18n("Look up a word or phrase with Kdict"));

  iconLabel = new QLabel(baseWidget);
  iconLabel->setBackgroundOrigin(AncestorOrigin);
  QPixmap pm = KGlobal::iconLoader()->loadIcon("kdict", KIcon::Panel, KIcon::SizeSmall, KIcon::DefaultState, 0L, true);
  iconLabel->setPixmap(pm);
  baseLay->addWidget(iconLabel,1,0);
  iconLabel->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
  iconLabel->setFixedWidth(pm.width()+4);
  QToolTip::add(iconLabel,i18n("Look up a word or phrase with Kdict"));

  f.setPixelSize(10);
  clipboardBtn = new QPushButton(i18n("C"),baseWidget);
  clipboardBtn->setBackgroundOrigin(AncestorOrigin);
  clipboardBtn->setFont(f);
  clipboardBtn->setFixedSize(16,16);
  connect(clipboardBtn, SIGNAL(clicked()), SLOT(queryClipboard()));
  baseLay->addWidget(clipboardBtn,0,3);
  QToolTip::add(clipboardBtn,i18n("Define selected text"));

  defineBtn = new QPushButton(i18n("D"),baseWidget);
  defineBtn->setBackgroundOrigin(AncestorOrigin);
  defineBtn->setFont(f);
  defineBtn->setFixedSize(16,16);
  defineBtn->setEnabled(false);
  connect(defineBtn, SIGNAL(clicked()), SLOT(startDefine()));
  baseLay->addWidget(defineBtn,0,4);
  QToolTip::add(defineBtn,i18n("Define word/phrase"));

  matchBtn = new QPushButton(i18n("M"),baseWidget);
  matchBtn->setBackgroundOrigin(AncestorOrigin);
  matchBtn->setFont(f);
  matchBtn->setFixedSize(16,16);
  matchBtn->setEnabled(false);
  connect(matchBtn, SIGNAL(clicked()), SLOT(startMatch()));
  baseLay->addWidget(matchBtn,0,5);
  QToolTip::add(matchBtn,i18n("Find matching definitions"));

  completionObject = new KCompletion();

  internalCombo = new KHistoryCombo(baseWidget);
  internalCombo->setBackgroundOrigin(AncestorOrigin);
  internalCombo->setCompletionObject(completionObject);
  internalCombo->setFocus();
  internalCombo->clearEdit();
  internalCombo->lineEdit()->installEventFilter( this );
  connect(internalCombo, SIGNAL(returnPressed(const QString&)), SLOT(startQuery(const QString&)));
  connect(internalCombo, SIGNAL(textChanged(const QString&)), SLOT(comboTextChanged(const QString&)));
  QToolTip::add(internalCombo,i18n("Look up a word or phrase with Kdict"));

  baseLay->addMultiCellWidget(internalCombo,1,1,1,5);

  baseLay->setColStretch(2,1);
	
  // widgets for a vertical panel
  verticalBtn = new QPushButton(this);
  connect(verticalBtn, SIGNAL(pressed()), SLOT(showExternalCombo()));	
  QToolTip::add(verticalBtn,i18n("Look up a word or phrase with Kdict"));

  popupBox = new PopupBox();
  popupBox->setFixedSize(160, 22);
  connect(popupBox, SIGNAL(hidden()), SLOT(externalComboHidden()));
  externalCombo = new KHistoryCombo(popupBox);
  externalCombo->setCompletionObject(completionObject);  
  connect(externalCombo, SIGNAL(returnPressed(const QString&)), SLOT(startQuery(const QString&)));
  externalCombo->setFixedSize(160, externalCombo->sizeHint().height());
  
  connect(internalCombo, SIGNAL(completionModeChanged(KGlobalSettings::Completion)),
          this, SLOT(updateCompletionMode(KGlobalSettings::Completion)));
  connect(externalCombo, SIGNAL(completionModeChanged(KGlobalSettings::Completion)),
          this, SLOT(updateCompletionMode(KGlobalSettings::Completion)));

  // restore history and completion list
  KConfig *c = config();
  c->setGroup("General");

  QStringList list = c->readListEntry("Completion list");
  completionObject->setItems(list);
  int mode = c->readNumEntry("Completion mode", 
                             KGlobalSettings::completionMode());
  internalCombo->setCompletionMode((KGlobalSettings::Completion)mode);  
  externalCombo->setCompletionMode((KGlobalSettings::Completion)mode);  

  list = c->readListEntry("History list");
  internalCombo->setHistoryItems(list);  
  externalCombo->setHistoryItems(list);
}
Пример #8
0
  IdentityDialog::IdentityDialog( QWidget * parent, const char * name )
    : KDialogBase( Plain, i18n("Edit Identity"), Ok|Cancel|Help, Ok,
                   parent, name )
  {
    // tmp. vars:
    QWidget * tab;
    QLabel  * label;
    int row;
    QGridLayout * glay;
    QString msg;

    //
    // Tab Widget: General
    //
    row = -1;
    QVBoxLayout * vlay = new QVBoxLayout( plainPage(), 0, spacingHint() );
    QTabWidget *tabWidget = new QTabWidget( plainPage(), "config-identity-tab" );
    vlay->addWidget( tabWidget );

    tab = new QWidget( tabWidget );
    tabWidget->addTab( tab, i18n("&General") );
    glay = new QGridLayout( tab, 4, 2, marginHint(), spacingHint() );
    glay->setRowStretch( 3, 1 );
    glay->setColStretch( 1, 1 );

    // "Name" line edit and label:
    ++row;
    mNameEdit = new KLineEdit( tab );
    glay->addWidget( mNameEdit, row, 1 );
    label = new QLabel( mNameEdit, i18n("&Your name:"), tab );
    glay->addWidget( label, row, 0 );
    msg = i18n("<qt><h3>Your name</h3>"
               "<p>This field should contain your name as you would like "
               "it to appear in the email header that is sent out;</p>"
               "<p>if you leave this blank your real name will not "
               "appear, only the email address.</p></qt>");
    QWhatsThis::add( label, msg );
    QWhatsThis::add( mNameEdit, msg );

    // "Organization" line edit and label:
    ++row;
    mOrganizationEdit = new KLineEdit( tab );
    glay->addWidget( mOrganizationEdit, row, 1 );
    label =  new QLabel( mOrganizationEdit, i18n("Organi&zation:"), tab );
    glay->addWidget( label, row, 0 );
    msg = i18n("<qt><h3>Organization</h3>"
               "<p>This field should have the name of your organization "
               "if you'd like it to be shown in the email header that "
               "is sent out.</p>"
               "<p>It is safe (and normal) to leave this blank.</p></qt>");
    QWhatsThis::add( label, msg );
    QWhatsThis::add( mOrganizationEdit, msg );

    // "Email Address" line edit and label:
    // (row 3: spacer)
    ++row;
    mEmailEdit = new KLineEdit( tab );
    glay->addWidget( mEmailEdit, row, 1 );
    label = new QLabel( mEmailEdit, i18n("&Email address:"), tab );
    glay->addWidget( label, row, 0 );
    msg = i18n("<qt><h3>Email address</h3>"
               "<p>This field should have your full email address.</p>"
               "<p>If you leave this blank, or get it wrong, people "
               "will have trouble replying to you.</p></qt>");
    QWhatsThis::add( label, msg );
    QWhatsThis::add( mEmailEdit, msg );

    //
    // Tab Widget: Cryptography
    //
    row = -1;
    mCryptographyTab = tab = new QWidget( tabWidget );
    tabWidget->addTab( tab, i18n("Cryptograph&y") );
    glay = new QGridLayout( tab, 6, 2, marginHint(), spacingHint() );
    glay->setColStretch( 1, 1 );

    // "OpenPGP Signature Key" requester and label:
    ++row;
    mPGPSigningKeyRequester = new Kleo::SigningKeyRequester( false, Kleo::SigningKeyRequester::OpenPGP, tab );
    mPGPSigningKeyRequester->dialogButton()->setText( i18n("Chang&e...") );
    mPGPSigningKeyRequester->setDialogCaption( i18n("Your OpenPGP Signature Key") );
    msg = i18n("Select the OpenPGP key which should be used to "
	       "digitally sign your messages.");
    mPGPSigningKeyRequester->setDialogMessage( msg );

    msg = i18n("<qt><p>The OpenPGP key you choose here will be used "
               "to digitally sign messages. You can also use GnuPG keys.</p>"
               "<p>You can leave this blank, but KMail will not be able "
               "to digitally sign emails using OpenPGP; "
	       "normal mail functions will not be affected.</p>"
               "<p>You can find out more about keys at <a>http://www.gnupg.org</a></p></qt>");

    label = new QLabel( mPGPSigningKeyRequester, i18n("OpenPGP signing key:"), tab );
    QWhatsThis::add( mPGPSigningKeyRequester, msg );
    QWhatsThis::add( label, msg );

    glay->addWidget( label, row, 0 );
    glay->addWidget( mPGPSigningKeyRequester, row, 1 );


    // "OpenPGP Encryption Key" requester and label:
    ++row;
    mPGPEncryptionKeyRequester = new Kleo::EncryptionKeyRequester( false, Kleo::EncryptionKeyRequester::OpenPGP, tab );
    mPGPEncryptionKeyRequester->dialogButton()->setText( i18n("Chang&e...") );
    mPGPEncryptionKeyRequester->setDialogCaption( i18n("Your OpenPGP Encryption Key") );
    msg = i18n("Select the OpenPGP key which should be used when encrypting "
	       "to yourself and for the \"Attach My Public Key\" "
	       "feature in the composer.");
    mPGPEncryptionKeyRequester->setDialogMessage( msg );

    msg = i18n("<qt><p>The OpenPGP key you choose here will be used "
               "to encrypt messages to yourself and for the \"Attach My Public Key\" "
	       "feature in the composer. You can also use GnuPG keys.</p>"
               "<p>You can leave this blank, but KMail will not be able "
               "to encrypt copies of outgoing messages to you using OpenPGP; "
	       "normal mail functions will not be affected.</p>"
               "<p>You can find out more about keys at <a>http://www.gnupg.org</a></qt>");
    label = new QLabel( mPGPEncryptionKeyRequester, i18n("OpenPGP encryption key:"), tab );
    QWhatsThis::add( mPGPEncryptionKeyRequester, msg );
    QWhatsThis::add( label, msg );

    glay->addWidget( label, row, 0 );
    glay->addWidget( mPGPEncryptionKeyRequester, row, 1 );


    // "S/MIME Signature Key" requester and label:
    ++row;
    mSMIMESigningKeyRequester = new Kleo::SigningKeyRequester( false, Kleo::SigningKeyRequester::SMIME, tab );
    mSMIMESigningKeyRequester->dialogButton()->setText( i18n("Chang&e...") );
    mSMIMESigningKeyRequester->setDialogCaption( i18n("Your S/MIME Signature Certificate") );
    msg = i18n("Select the S/MIME certificate which should be used to "
	       "digitally sign your messages.");
    mSMIMESigningKeyRequester->setDialogMessage( msg );

    msg = i18n("<qt><p>The S/MIME (X.509) certificate you choose here will be used "
               "to digitally sign messages.</p>"
               "<p>You can leave this blank, but KMail will not be able "
               "to digitally sign emails using S/MIME; "
	       "normal mail functions will not be affected.</p></qt>");
    label = new QLabel( mSMIMESigningKeyRequester, i18n("S/MIME signing certificate:"), tab );
    QWhatsThis::add( mSMIMESigningKeyRequester, msg );
    QWhatsThis::add( label, msg );
    glay->addWidget( label, row, 0 );
    glay->addWidget( mSMIMESigningKeyRequester, row, 1 );

    const Kleo::CryptoBackend::Protocol * smimeProtocol
      = Kleo::CryptoBackendFactory::instance()->smime();

    label->setEnabled( smimeProtocol );
    mSMIMESigningKeyRequester->setEnabled( smimeProtocol );

    // "S/MIME Encryption Key" requester and label:
    ++row;
    mSMIMEEncryptionKeyRequester = new Kleo::EncryptionKeyRequester( false, Kleo::EncryptionKeyRequester::SMIME, tab );
    mSMIMEEncryptionKeyRequester->dialogButton()->setText( i18n("Chang&e...") );
    mSMIMEEncryptionKeyRequester->setDialogCaption( i18n("Your S/MIME Encryption Certificate") );
    msg = i18n("Select the S/MIME certificate which should be used when encrypting "
	       "to yourself and for the \"Attach My Certificate\" "
	       "feature in the composer.");
    mSMIMEEncryptionKeyRequester->setDialogMessage( msg );

    msg = i18n("<qt><p>The S/MIME certificate you choose here will be used "
               "to encrypt messages to yourself and for the \"Attach My Certificate\" "
	       "feature in the composer.</p>"
               "<p>You can leave this blank, but KMail will not be able "
               "to encrypt copies of outgoing messages to you using S/MIME; "
	       "normal mail functions will not be affected.</p></qt>");
    label = new QLabel( mSMIMEEncryptionKeyRequester, i18n("S/MIME encryption certificate:"), tab );
    QWhatsThis::add( mSMIMEEncryptionKeyRequester, msg );
    QWhatsThis::add( label, msg );

    glay->addWidget( label, row, 0 );
    glay->addWidget( mSMIMEEncryptionKeyRequester, row, 1 );

    label->setEnabled( smimeProtocol );
    mSMIMEEncryptionKeyRequester->setEnabled( smimeProtocol );

    // "Preferred Crypto Message Format" combobox and label:
    ++row;
    mPreferredCryptoMessageFormat = new QComboBox( false, tab );
    QStringList l;
    l << Kleo::cryptoMessageFormatToLabel( Kleo::AutoFormat )
      << Kleo::cryptoMessageFormatToLabel( Kleo::InlineOpenPGPFormat )
      << Kleo::cryptoMessageFormatToLabel( Kleo::OpenPGPMIMEFormat )
      << Kleo::cryptoMessageFormatToLabel( Kleo::SMIMEFormat )
      << Kleo::cryptoMessageFormatToLabel( Kleo::SMIMEOpaqueFormat );
    mPreferredCryptoMessageFormat->insertStringList( l );
    label = new QLabel( mPreferredCryptoMessageFormat,
			i18n("Preferred crypto message format:"), tab );

    glay->addWidget( label, row, 0 );
    glay->addWidget( mPreferredCryptoMessageFormat, row, 1 );

    ++row;
    glay->setRowStretch( row, 1 );

    //
    // Tab Widget: Advanced
    //
    row = -1;
    tab = new QWidget( tabWidget );
    tabWidget->addTab( tab, i18n("&Advanced") );
    glay = new QGridLayout( tab, 8, 2, marginHint(), spacingHint() );
    // the last (empty) row takes all the remaining space
    glay->setRowStretch( 8-1, 1 );
    glay->setColStretch( 1, 1 );

    // "Reply-To Address" line edit and label:
    ++row;
    mReplyToEdit = new KPIM::AddresseeLineEdit( tab, true, "mReplyToEdit" );
    glay->addWidget( mReplyToEdit, row, 1 );
    label = new QLabel ( mReplyToEdit, i18n("&Reply-To address:"), tab);
    glay->addWidget( label , row, 0 );
    msg = i18n("<qt><h3>Reply-To addresses</h3>"
               "<p>This sets the <tt>Reply-to:</tt> header to contain a "
               "different email address to the normal <tt>From:</tt> "
               "address.</p>"
               "<p>This can be useful when you have a group of people "
               "working together in similar roles. For example, you "
               "might want any emails sent to have your email in the "
               "<tt>From:</tt> field, but any responses to go to "
               "a group address.</p>"
               "<p>If in doubt, leave this field blank.</p></qt>");
    QWhatsThis::add( label, msg );
    QWhatsThis::add( mReplyToEdit, msg );

    // "BCC addresses" line edit and label:
    ++row;
    mBccEdit = new KPIM::AddresseeLineEdit( tab, true, "mBccEdit" );
    glay->addWidget( mBccEdit, row, 1 );
    label = new QLabel( mBccEdit, i18n("&BCC addresses:"), tab );
    glay->addWidget( label, row, 0 );
    msg = i18n("<qt><h3>BCC (Blind Carbon Copy) addresses</h3>"
               "<p>The addresses that you enter here will be added to each "
               "outgoing mail that is sent with this identity. They will not "
               "be visible to other recipients.</p>"
               "<p>This is commonly used to send a copy of each sent message to "
               "another account of yours.</p>"
               "<p>To specify more than one address, use commas to separate "
               "the list of BCC recipients.</p>"
               "<p>If in doubt, leave this field blank.</p></qt>");
    QWhatsThis::add( label, msg );
    QWhatsThis::add( mBccEdit, msg );

    // "Dictionary" combo box and label:
    ++row;
    mDictionaryCombo = new DictionaryComboBox( tab );
    glay->addWidget( mDictionaryCombo, row, 1 );
    glay->addWidget( new QLabel( mDictionaryCombo, i18n("D&ictionary:"), tab ),
                     row, 0 );

    // "Sent-mail Folder" combo box and label:
    ++row;
    mFccCombo = new FolderRequester( tab, 
        kmkernel->getKMMainWidget()->folderTree() );
    mFccCombo->setShowOutbox( false );
    glay->addWidget( mFccCombo, row, 1 );
    glay->addWidget( new QLabel( mFccCombo, i18n("Sent-mail &folder:"), tab ),
                     row, 0 );

    // "Drafts Folder" combo box and label:
    ++row;
    mDraftsCombo = new FolderRequester( tab,
        kmkernel->getKMMainWidget()->folderTree() );
    mDraftsCombo->setShowOutbox( false );
    glay->addWidget( mDraftsCombo, row, 1 );
    glay->addWidget( new QLabel( mDraftsCombo, i18n("&Drafts folder:"), tab ),
                     row, 0 );

    // "Templates Folder" combo box and label:
    ++row;
    mTemplatesCombo = new FolderRequester( tab,
        kmkernel->getKMMainWidget()->folderTree() );
    mTemplatesCombo->setShowOutbox( false );
    glay->addWidget( mTemplatesCombo, row, 1 );
    glay->addWidget( new QLabel( mTemplatesCombo, i18n("&Templates folder:"), tab ),
                     row, 0 );

    // "Special transport" combobox and label:
    ++row;
    mTransportCheck = new QCheckBox( i18n("Special &transport:"), tab );
    glay->addWidget( mTransportCheck, row, 0 );
    mTransportCombo = new QComboBox( true, tab );
    mTransportCombo->setEnabled( false ); // since !mTransportCheck->isChecked()
    mTransportCombo->insertStringList( KMail::TransportManager::transportNames() );
    glay->addWidget( mTransportCombo, row, 1 );
    connect( mTransportCheck, SIGNAL(toggled(bool)),
             mTransportCombo, SLOT(setEnabled(bool)) );

    // the last row is a spacer
    
    // 
    // Tab Widget: Templates
    // 
		tab = new QWidget( tabWidget );
    tabWidget->addTab( tab, i18n("&Templates") );
    vlay = new QVBoxLayout( tab, marginHint(), spacingHint() );
		mCustom = new QCheckBox( i18n("&Use custom message templates"), tab );
		vlay->addWidget( mCustom );
		mWidget = new TemplatesConfiguration( tab , "identity-templates" );
		mWidget->setEnabled( false );
		vlay->addWidget( mWidget );
		QHBoxLayout *btns = new QHBoxLayout( vlay, spacingHint() );
		mCopyGlobal = new KPushButton( i18n("&Copy global templates"), tab );
		mCopyGlobal->setEnabled( false );
		btns->addWidget( mCopyGlobal );
		connect( mCustom, SIGNAL( toggled( bool ) ),
					mWidget, SLOT( setEnabled( bool ) ) );
		connect( mCustom, SIGNAL( toggled( bool ) ),
					mCopyGlobal, SLOT( setEnabled( bool ) ) );
		connect( mCopyGlobal, SIGNAL(clicked()),
					this, SLOT(slotCopyGlobal()) );
		
    //
    // Tab Widget: Signature
    //
    mSignatureConfigurator = new SignatureConfigurator( tabWidget );
    mSignatureConfigurator->layout()->setMargin( KDialog::marginHint() );
    tabWidget->addTab( mSignatureConfigurator, i18n("&Signature") );

    mXFaceConfigurator = new XFaceConfigurator( tabWidget );
    mXFaceConfigurator->layout()->setMargin( KDialog::marginHint() );
    tabWidget->addTab( mXFaceConfigurator, i18n("&Picture") );

    KConfigGroup geometry( KMKernel::config(), "Geometry" );
    if ( geometry.hasKey( "Identity Dialog size" ) )
      resize( geometry.readSizeEntry( "Identity Dialog size" ) );
    mNameEdit->setFocus();

    connect( tabWidget, SIGNAL(currentChanged(QWidget*)),
	     SLOT(slotAboutToShow(QWidget*)) );
  }
Пример #9
0
KDMAppearanceWidget::KDMAppearanceWidget(QWidget *parent, const char *name) : QWidget(parent, name)
{
    QString wtstr;

    QVBoxLayout *vbox = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint(), "vbox");
    QGroupBox *group = new QGroupBox(i18n("Appearance"), this);
    vbox->addWidget(group);

    QGridLayout *grid = new QGridLayout(group, 5, 2, KDialog::marginHint(), KDialog::spacingHint(), "grid");
    grid->addRowSpacing(0, group->fontMetrics().height());
    grid->setColStretch(0, 1);
    grid->setColStretch(1, 1);

    QHBoxLayout *hlay = new QHBoxLayout(KDialog::spacingHint());
    grid->addMultiCellLayout(hlay, 1, 1, 0, 1);
    greetstr_lined = new KLineEdit(group);
    QLabel *label = new QLabel(greetstr_lined, i18n("&Greeting:"), group);
    hlay->addWidget(label);
    connect(greetstr_lined, SIGNAL(textChanged(const QString &)), SLOT(changed()));
    hlay->addWidget(greetstr_lined);
    wtstr = i18n(
        "This is the \"headline\" for KDM's login window. You may want to "
        "put some nice greeting or information about the operating system here.<p>"
        "KDM will substitute the following character pairs with the "
        "respective contents:<br><ul>"
        "<li>%d -> current display</li>"
        "<li>%h -> host name, possibly with domain name</li>"
        "<li>%n -> node name, most probably the host name without domain name</li>"
        "<li>%s -> the operating system</li>"
        "<li>%r -> the operating system's version</li>"
        "<li>%m -> the machine (hardware) type</li>"
        "<li>%% -> a single %</li>"
        "</ul>");
    QWhatsThis::add(label, wtstr);
    QWhatsThis::add(greetstr_lined, wtstr);


    QGridLayout *hglay = new QGridLayout(3, 4, KDialog::spacingHint());
    grid->addMultiCellLayout(hglay, 2, 4, 0, 0);

    label = new QLabel(i18n("Logo area:"), group);
    hglay->addWidget(label, 0, 0);
    QVBoxLayout *vlay = new QVBoxLayout(KDialog::spacingHint());
    hglay->addMultiCellLayout(vlay, 0, 0, 1, 2);
    noneRadio = new QRadioButton(i18n("logo area", "&None"), group);
    clockRadio = new QRadioButton(i18n("Show cloc&k"), group);
    logoRadio = new QRadioButton(i18n("Sho&w logo"), group);
    QButtonGroup *buttonGroup = new QButtonGroup(group);
    label->setBuddy(buttonGroup);
    connect(buttonGroup, SIGNAL(clicked(int)), SLOT(slotAreaRadioClicked(int)));
    connect(buttonGroup, SIGNAL(clicked(int)), SLOT(changed()));
    buttonGroup->hide();
    buttonGroup->insert(noneRadio, KdmNone);
    buttonGroup->insert(clockRadio, KdmClock);
    buttonGroup->insert(logoRadio, KdmLogo);
    vlay->addWidget(noneRadio);
    vlay->addWidget(clockRadio);
    vlay->addWidget(logoRadio);
    wtstr = i18n("You can choose to display a custom logo (see below), a clock or no logo at all.");
    QWhatsThis::add(label, wtstr);
    QWhatsThis::add(noneRadio, wtstr);
    QWhatsThis::add(logoRadio, wtstr);
    QWhatsThis::add(clockRadio, wtstr);

    logoLabel = new QLabel(i18n("&Logo:"), group);
    logobutton = new QPushButton(group);
    logoLabel->setBuddy(logobutton);
    logobutton->setAutoDefault(false);
    logobutton->setAcceptDrops(true);
    logobutton->installEventFilter(this); // for drag and drop
    connect(logobutton, SIGNAL(clicked()), SLOT(slotLogoButtonClicked()));
    hglay->addWidget(logoLabel, 1, 0);
    hglay->addWidget(logobutton, 1, 1, AlignCenter);
    hglay->addRowSpacing(1, 110);
    wtstr = i18n(
        "Click here to choose an image that KDM will display. "
        "You can also drag and drop an image onto this button "
        "(e.g. from Konqueror).");
    QWhatsThis::add(logoLabel, wtstr);
    QWhatsThis::add(logobutton, wtstr);
    hglay->addRowSpacing(2, KDialog::spacingHint());
    hglay->setColStretch(3, 1);


    hglay = new QGridLayout(2, 3, KDialog::spacingHint());
    grid->addLayout(hglay, 2, 1);

    label = new QLabel(i18n("Position:"), group);
    hglay->addMultiCellWidget(label, 0, 1, 0, 0, AlignVCenter);
    QValidator *posValidator = new QIntValidator(0, 100, group);
    QLabel *xLineLabel = new QLabel(i18n("&X:"), group);
    hglay->addWidget(xLineLabel, 0, 1);
    xLineEdit = new QLineEdit(group);
    connect(xLineEdit, SIGNAL(textChanged(const QString &)), SLOT(changed()));
    hglay->addWidget(xLineEdit, 0, 2);
    xLineLabel->setBuddy(xLineEdit);
    xLineEdit->setValidator(posValidator);
    QLabel *yLineLabel = new QLabel(i18n("&Y:"), group);
    hglay->addWidget(yLineLabel, 1, 1);
    yLineEdit = new QLineEdit(group);
    connect(yLineEdit, SIGNAL(textChanged(const QString &)), SLOT(changed()));
    hglay->addWidget(yLineEdit, 1, 2);
    yLineLabel->setBuddy(yLineEdit);
    yLineEdit->setValidator(posValidator);
    wtstr = i18n("Here you specify the relative coordinates (in percent) of the login dialog's <em>center</em>.");
    QWhatsThis::add(label, wtstr);
    QWhatsThis::add(xLineLabel, wtstr);
    QWhatsThis::add(xLineEdit, wtstr);
    QWhatsThis::add(yLineLabel, wtstr);
    QWhatsThis::add(yLineEdit, wtstr);
    hglay->setColStretch(3, 1);
    hglay->setRowStretch(2, 1);


    hglay = new QGridLayout(2, 3, KDialog::spacingHint());
    grid->addLayout(hglay, 3, 1);
    hglay->setColStretch(3, 1);

    guicombo = new KBackedComboBox(group);
    guicombo->insertItem("", i18n("<default>"));
    loadGuiStyles(guicombo);
    guicombo->listBox()->sort();
    label = new QLabel(guicombo, i18n("GUI s&tyle:"), group);
    connect(guicombo, SIGNAL(activated(int)), SLOT(changed()));
    hglay->addWidget(label, 0, 0);
    hglay->addWidget(guicombo, 0, 1);
    wtstr = i18n(
        "You can choose a basic GUI style here that will be "
        "used by KDM only.");
    QWhatsThis::add(label, wtstr);
    QWhatsThis::add(guicombo, wtstr);

    colcombo = new KBackedComboBox(group);
    colcombo->insertItem("", i18n("<default>"));
    loadColorSchemes(colcombo);
    colcombo->listBox()->sort();
    label = new QLabel(colcombo, i18n("&Color scheme:"), group);
    connect(colcombo, SIGNAL(activated(int)), SLOT(changed()));
    hglay->addWidget(label, 1, 0);
    hglay->addWidget(colcombo, 1, 1);
    wtstr = i18n(
        "You can choose a basic Color Scheme here that will be "
        "used by KDM only.");
    QWhatsThis::add(label, wtstr);
    QWhatsThis::add(colcombo, wtstr);

    echocombo = new KBackedComboBox(group);
    echocombo->insertItem("NoEcho", i18n("No Echo"));
    echocombo->insertItem("OneStar", i18n("One Star"));
    echocombo->insertItem("ThreeStars", i18n("Three Stars"));
    label = new QLabel(echocombo, i18n("Echo &mode:"), group);
    connect(echocombo, SIGNAL(activated(int)), SLOT(changed()));
    hglay->addWidget(label, 2, 0);
    hglay->addWidget(echocombo, 2, 1);
    wtstr = i18n("You can choose whether and how KDM shows your password when you type it.");
    QWhatsThis::add(label, wtstr);
    QWhatsThis::add(echocombo, wtstr);


    // The Language group box
    group = new QGroupBox(0, Vertical, i18n("Locale"), this);
    vbox->addWidget(group);

    langcombo = new KLanguageButton(group);
    loadLanguageList(langcombo);
    connect(langcombo, SIGNAL(activated(const QString &)), SLOT(changed()));
    label = new QLabel(langcombo, i18n("Languag&e:"), group);
    QGridLayout *hbox = new QGridLayout(group->layout(), 2, 2, KDialog::spacingHint());
    hbox->setColStretch(1, 1);
    hbox->addWidget(label, 1, 0);
    hbox->addWidget(langcombo, 1, 1);
    wtstr = i18n(
        "Here you can choose the language used by KDM. This setting does not affect"
        " a user's personal settings; that will take effect after login.");
    QWhatsThis::add(label, wtstr);
    QWhatsThis::add(langcombo, wtstr);


    vbox->addStretch(1);
}
Пример #10
0
KileWidgetPreviewConfig::KileWidgetPreviewConfig(KConfig *config, KileTool::QuickPreview *preview, QWidget *parent, const char *name )
	: QWidget(parent,name),
	  m_config(config),
	  m_preview(preview)
{
	// Layout
	QVBoxLayout *vbox = new QVBoxLayout(this, 5,5 );

	QGroupBox *groupbox = new QGroupBox( i18n("Quick Preview in a separate window"), this, "groupbox" );
	groupbox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, 0, 0, groupbox->sizePolicy().hasHeightForWidth() ) );
	groupbox->setColumnLayout(0, Qt::Vertical ); 
	groupbox->layout()->setSpacing( 6 ); 
	groupbox->layout()->setMargin( 11 );
	QGridLayout *groupboxLayout = new QGridLayout( groupbox->layout() );
	groupboxLayout->setAlignment( Qt::AlignTop );
   
	QLabel *label = new QLabel( i18n("Select a configuration:"), groupbox, "label");
	m_combobox = new KComboBox(false,groupbox,"combobox" );

	groupboxLayout->addWidget(label,0,0);
	groupboxLayout->addWidget(m_combobox,0,2);
	groupboxLayout->setColSpacing(1,8);
	groupboxLayout->setColStretch(3,1);
	
	QGroupBox *gbResolution = new QGroupBox( i18n("Quick Preview in bottom bar"), this, "gbresolution" );
	gbResolution->setColumnLayout(0, Qt::Vertical );
	gbResolution->layout()->setSpacing( 6 );
	gbResolution->layout()->setMargin( 11 );
	QGridLayout *resLayout = new QGridLayout( gbResolution->layout() );
	resLayout->setAlignment( Qt::AlignTop );

	QLabel *resLabel = new QLabel( i18n("&Resolution:"), gbResolution );
	m_leDvipngResolution = new KLineEdit( gbResolution, "DvipngResolution" );
	QLabel *resDpi = new QLabel( i18n("dpi"), gbResolution );
	QLabel *resAllowed = new QLabel( i18n("(allowed values: 30-1000 dpi)"), gbResolution );
	
	// set validator
	QValidator* validator = new QIntValidator(30,1000,this);
	m_leDvipngResolution->setValidator(validator);
	resLabel->setBuddy(m_leDvipngResolution);

	QString sep = "&nbsp;&nbsp;&nbsp;&nbsp;";
	QString title = i18n("Kile supports three kinds of conversion to png images");
	QString tool1 = i18n("dvi --> png") + sep + i18n("(uses dvipng)");
	QString tool2 = i18n("dvi --> ps --> png") + sep + i18n("(uses dvips/convert)");
	QString tool3 = i18n("pdf --> png") + sep + i18n("(uses convert)");
	QString description = QString("%1:<ul><li>%2<li>%3<li>%4</ul>").arg(title).arg(tool1).arg(tool2).arg(tool3);

	QLabel *labelDescription = new QLabel(description, gbResolution);
	QLabel *labelDvipng = new QLabel(i18n("dvipng:"), gbResolution);
	QLabel *labelConvert = new QLabel(i18n("convert:"), gbResolution);
	m_lbDvipng = new QLabel(gbResolution);
	m_lbConvert = new QLabel(gbResolution);
	
	resLayout->addWidget(resLabel,0,0);
	resLayout->addWidget(m_leDvipngResolution,0,2);
	resLayout->addWidget(resDpi,0,3);
	resLayout->addWidget(resAllowed,0,5,Qt::AlignLeft);
	resLayout->addMultiCellWidget(labelDescription,1,1,0,5);
	resLayout->addWidget(labelDvipng,2,0);
	resLayout->addWidget(m_lbDvipng,2,2);
	resLayout->addWidget(labelConvert,3,0);
	resLayout->addWidget(m_lbConvert,3,2);
	resLayout->setColSpacing(1,8);
	resLayout->setColSpacing(4,24);
	resLayout->setColStretch(5,1);

	m_gbPreview = new QGroupBox( i18n("Properties"), this, "gbpreview" );
	m_gbPreview->setColumnLayout(0, Qt::Vertical );
	m_gbPreview->layout()->setSpacing( 6 );
	m_gbPreview->layout()->setMargin( 11 );
	QGridLayout *previewLayout = new QGridLayout( m_gbPreview->layout() );
	previewLayout->setAlignment( Qt::AlignTop );

	QLabel *labelPreviewWidget = new QLabel(i18n("Show preview in bottom bar:"), m_gbPreview);
	QLabel *labelPreviewType = new QLabel(i18n("Conversion to image:"), m_gbPreview);
	QLabel *labelSelection = new QLabel(i18n("Selection:"), m_gbPreview);
	QLabel *labelEnvironment = new QLabel(i18n("Environment:"), m_gbPreview);
	QLabel *labelMathgroup = new QLabel(i18n("Mathgroup:"), m_gbPreview);
	QLabel *labelSubdocument1 = new QLabel(i18n("Subdocument:"), m_gbPreview);
	QLabel *labelSubdocument2 = new QLabel(i18n("Not available, opens always in a separate window."), m_gbPreview);
	m_cbSelection = new QCheckBox(m_gbPreview);
	m_cbEnvironment = new QCheckBox(m_gbPreview);
	m_cbMathgroup = new QCheckBox(m_gbPreview);
	m_coSelection = new KComboBox(false,m_gbPreview);
	m_coEnvironment = new KComboBox(false,m_gbPreview);
	m_lbMathgroup = new QLabel(i18n("Preview uses always 'dvipng'."), m_gbPreview);

	previewLayout->addMultiCellWidget(labelPreviewWidget,0,0,0,2);
	previewLayout->addWidget(labelPreviewType,0,4);
	previewLayout->addWidget(labelSelection,1,0);
	previewLayout->addWidget(m_cbSelection,1,2);
	previewLayout->addWidget(m_coSelection,1,4);
	previewLayout->addWidget(labelEnvironment,2,0);
	previewLayout->addWidget(m_cbEnvironment,2,2);
	previewLayout->addWidget(m_coEnvironment,2,4);
	previewLayout->addWidget(labelMathgroup,3,0);
	previewLayout->addWidget(m_cbMathgroup,3,2);
	previewLayout->addMultiCellWidget(m_lbMathgroup,3,3,4,5,Qt::AlignLeft);
	previewLayout->addWidget(labelSubdocument1,4,0);
	previewLayout->addMultiCellWidget(labelSubdocument2,4,4,2,5,Qt::AlignLeft);
	previewLayout->setRowSpacing(0,3*labelPreviewWidget->sizeHint().height()/2);
	previewLayout->setRowSpacing(3,m_coEnvironment->sizeHint().height());
	previewLayout->setColSpacing(1,12);
	previewLayout->setColSpacing(3,40);
	previewLayout->setColStretch(5,1);

	vbox->addWidget(groupbox);
	vbox->addWidget(gbResolution);
	vbox->addWidget(m_gbPreview);
	vbox->addStretch();

	connect(m_cbEnvironment,SIGNAL(clicked()),this,SLOT(updateConversionTools()));
	connect(m_cbSelection,SIGNAL(clicked()),this,SLOT(updateConversionTools()));
	connect(m_cbMathgroup,SIGNAL(clicked()),this,SLOT(updateConversionTools()));
}
Пример #11
0
/******************************************************************************
*  Display the Find dialog.
*/
void Find::display()
{
    if(!mOptions)
        // Set defaults the first time the Find dialog is activated
        mOptions = FIND_LIVE | FIND_EXPIRED | FIND_MESSAGE | FIND_FILE | FIND_COMMAND | FIND_EMAIL;
    bool noExpired = !Preferences::expiredKeepDays();
    bool showExpired = mListView->isA("AlarmListView") && ((AlarmListView *)mListView)->showingExpired();
    if(noExpired  ||  !showExpired)       // these settings could change between activations
        mOptions &= ~FIND_EXPIRED;

    if(mDialog)
    {
        KWin::activateWindow(mDialog->winId());
    }
    else
    {
#ifdef MODAL_FIND
        mDialog = new KFindDialog(mListView, "FindDlg", mOptions, mHistory, (mListView->selectedCount() > 1));
#else
        mDialog = new KFindDialog(false, mListView, "FindDlg", mOptions, mHistory, (mListView->selectedCount() > 1));
#endif
        mDialog->setHasSelection(false);
        QWidget *kalarmWidgets = mDialog->findExtension();

        // Alarm types
        QBoxLayout *layout = new QVBoxLayout(kalarmWidgets, 0, KDialog::spacingHint());
        QGroupBox *group = new QGroupBox(i18n("Alarm Type"), kalarmWidgets);
        layout->addWidget(group);
        QGridLayout *grid = new QGridLayout(group, 2, 2, KDialog::marginHint(), KDialog::spacingHint());
        grid->addRowSpacing(0, mDialog->fontMetrics().lineSpacing() / 2);
        grid->setColStretch(1, 1);

        // Live & expired alarm selection
        mLive = new QCheckBox(i18n("Acti&ve"), group);
        mLive->setFixedSize(mLive->sizeHint());
        QWhatsThis::add(mLive, i18n("Check to include active alarms in the search."));
        grid->addWidget(mLive, 1, 0, Qt::AlignAuto);

        mExpired = new QCheckBox(i18n("Ex&pired"), group);
        mExpired->setFixedSize(mExpired->sizeHint());
        QWhatsThis::add(mExpired,
                        i18n("Check to include expired alarms in the search. "
                             "This option is only available if expired alarms are currently being displayed."));
        grid->addWidget(mExpired, 1, 2, Qt::AlignAuto);

        mActiveExpiredSep = new KSeparator(Qt::Horizontal, kalarmWidgets);
        grid->addMultiCellWidget(mActiveExpiredSep, 2, 2, 0, 2);

        // Alarm actions
        mMessageType = new QCheckBox(i18n("Text"), group, "message");
        mMessageType->setFixedSize(mMessageType->sizeHint());
        QWhatsThis::add(mMessageType, i18n("Check to include text message alarms in the search."));
        grid->addWidget(mMessageType, 3, 0);

        mFileType = new QCheckBox(i18n("Fi&le"), group, "file");
        mFileType->setFixedSize(mFileType->sizeHint());
        QWhatsThis::add(mFileType, i18n("Check to include file alarms in the search."));
        grid->addWidget(mFileType, 3, 2);

        mCommandType = new QCheckBox(i18n("Co&mmand"), group, "command");
        mCommandType->setFixedSize(mCommandType->sizeHint());
        QWhatsThis::add(mCommandType, i18n("Check to include command alarms in the search."));
        grid->addWidget(mCommandType, 4, 0);

        mEmailType = new QCheckBox(i18n("&Email"), group, "email");
        mEmailType->setFixedSize(mEmailType->sizeHint());
        QWhatsThis::add(mEmailType, i18n("Check to include email alarms in the search."));
        grid->addWidget(mEmailType, 4, 2);

        // Set defaults
        mLive->setChecked(mOptions & FIND_LIVE);
        mExpired->setChecked(mOptions & FIND_EXPIRED);
        mMessageType->setChecked(mOptions & FIND_MESSAGE);
        mFileType->setChecked(mOptions & FIND_FILE);
        mCommandType->setChecked(mOptions & FIND_COMMAND);
        mEmailType->setChecked(mOptions & FIND_EMAIL);

#ifndef MODAL_FIND
        connect(mDialog, SIGNAL(okClicked()), this, SLOT(slotFind()));
#endif
    }

    // Only display active/expired options if expired alarms are being kept
    if(noExpired)
    {
        mLive->hide();
        mExpired->hide();
        mActiveExpiredSep->hide();
    }
    else
    {
        mLive->show();
        mExpired->show();
        mActiveExpiredSep->show();
    }

    // Disable options where no displayed alarms match them
    bool live    = false;
    bool expired = false;
    bool text    = false;
    bool file    = false;
    bool command = false;
    bool email   = false;
    for(EventListViewItemBase *item = mListView->firstChild();  item;  item = item->nextSibling())
    {
        const KAEvent &event = item->event();
        if(event.expired())
            expired = true;
        else
            live = true;
        switch(event.action())
        {
            case KAEvent::MESSAGE:
                text    = true;
                break;
            case KAEvent::FILE:
                file    = true;
                break;
            case KAEvent::COMMAND:
                command = true;
                break;
            case KAEvent::EMAIL:
                email   = true;
                break;
        }
    }
    mLive->setEnabled(live);
    mExpired->setEnabled(expired);
    mMessageType->setEnabled(text);
    mFileType->setEnabled(file);
    mCommandType->setEnabled(command);
    mEmailType->setEnabled(email);

    mDialog->setHasCursor(mListView->currentItem());
#ifdef MODAL_FIND
    if(mDialog->exec() == QDialog::Accepted)
        slotFind();
    else
        delete mDialog;
#else
    mDialog->show();
#endif
}
Пример #12
0
DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name )
  : QWidget(parent, name)
{
  QGridLayout *tl = new QGridLayout(this, 3, 3, 10, 10);
  tl->addRowSpacing(0, fontMetrics().lineSpacing() - 10);
  box = new QGroupBox(this);
  box->setTitle(i18n("DNS Servers"));
  tl->addMultiCellWidget(box, 0, 2, 0, 2);
  tl->setRowStretch(1, 1);
  tl->setColStretch(1, 1);
  tl->addColSpacing(0, 15);
  tl->addColSpacing(2, 15);
  tl->addRowSpacing(2, 10);

  QVBoxLayout *l1 = new QVBoxLayout;
  tl->addLayout(l1, 1, 1);
  l1->addSpacing(10);

  QGridLayout *l11 = new QGridLayout(5, 2);
  l1->addLayout(l11);

  dnsdomain_label = newLabel(i18n("Domain Name:"), this);
  l11->addWidget(dnsdomain_label, 0, 0);

  dnsdomain = new QLineEdit(this);
  dnsdomain->setMaxLength(DOMAIN_SIZE);
  FIXED_HEIGHT(dnsdomain);
  MIN_WIDTH(dnsdomain);
  l11->addWidget(dnsdomain, 0, 1);
  l11->addRowSpacing(1, 15);
  KQuickHelp::add(dnsdomain_label,
  KQuickHelp::add(dnsdomain, 
		  i18n("If you enter a domain name here, this domain\n"
		       "name is used for your computer while you are\n"
		       "connected. When the connection is closed, the\n"
		       "original domain name of your computer is\n"
		       "restored.\n"
		       "\n"
		       "If you leave this field blank, no changes are\n"
		       "made to the domain name.")));

  dns_label = newLabel(i18n("DNS IP Address:"), this);
  l11->addWidget(dns_label, 2, 0);

  QHBoxLayout *l110 = new QHBoxLayout;
  l11->addLayout(l110, 2, 1);
  dnsipaddr = new IPLineEdit(this);
  connect(dnsipaddr, SIGNAL(returnPressed()), 
	  SLOT(adddns()));
  connect(dnsipaddr, SIGNAL(textChanged(const char *)), 
	  SLOT(DNS_Edit_Changed(const char *)));
  FIXED_HEIGHT(dnsipaddr);
  l110->addWidget(dnsipaddr, 4);
  l110->addStretch(3);
  KQuickHelp::add(dns_label, 
  KQuickHelp::add(dnsipaddr, 
		  i18n("Allows you to specify a new DNS server to be\n"
		       "used while you are connected. When the\n"
		       "connection is closed, this DNS entry will be\n"
		       "removed again.\n"
		       "\n"
		       "To add a DNS server, type in the IP address of\n"
		       "of the DNS server here and click on <b>Add</b>")));

  QHBoxLayout *l111 = new QHBoxLayout;
  l11->addLayout(l111, 3, 1);
  add = new QPushButton(i18n("Add"), this);
  connect(add, SIGNAL(clicked()), SLOT(adddns()));
  FIXED_HEIGHT(add);
  int width = add->sizeHint().width();
  width = QMAX(width,60);
  add->setMinimumWidth(width);
  l111->addWidget(add);
  l111->addStretch(1);
  KQuickHelp::add(add,
		  i18n("Click this button to add the DNS server\n"
		       "specified in the field above. The entry\n"
		       "will then be added to the list below"));
		  
  remove = new QPushButton(i18n("Remove"), this);
  connect(remove, SIGNAL(clicked()), SLOT(removedns()));
  FIXED_HEIGHT(remove);
  width = remove->sizeHint().width();
  width = QMAX(width,60);
  remove->setMinimumWidth(width);
  l111->addWidget(remove);
  KQuickHelp::add(remove,
		  i18n("Click this button to remove the selected DNS\n"
		       "server entry from the list below"));

  servers_label = newLabel(i18n("DNS Address List:"), this);
  servers_label->setAlignment(AlignTop|AlignLeft);
  l11->addWidget(servers_label, 4, 0);
 
  dnsservers = new QListBox(this);
  dnsservers->setMinimumSize(150, 100);
  connect(dnsservers, SIGNAL(highlighted(int)),
	  SLOT(DNS_Entry_Selected(int)));
  l11->addWidget(dnsservers, 4, 1);
  KQuickHelp::add(servers_label,
  KQuickHelp::add(dnsservers,
		  i18n("This shows all defined DNS servers to use\n"
		       "while you are connected. Use the <b>Add</b> and\n"
		       "<b>Remove</b> buttons to modify the list")));

  exdnsdisabled_toggle = newCheckBox(i18n(
     "Disable existing DNS Servers during Connection"),
				       this);
  exdnsdisabled_toggle->setChecked(gpppdata.exDNSDisabled());
  l1->addStretch(2);
  l1->addWidget(exdnsdisabled_toggle);
  l1->addStretch(1);
  KQuickHelp::add(exdnsdisabled_toggle,
		  i18n("When this option is selected, all DNS\n"
		       "servers specified in <i>/etc/resolv.conf</i> are\n"
		       "temporary disabled while the dialup connection\n"
		       "is established. After the connection is\n"
		       "closed, the servers will be re-enabled\n"
		       "\n"
		       "Typically, there is no reason to use this\n"
		       "option, but it may become useful under \n"
		       "some circumstances"));
 
  // restore data if editing
  if(!isnewaccount) {
    QStrList &dnslist = gpppdata.dns();
    for(char *dns = dnslist.first(); dns; dns = dnslist.next())
      dnsservers->insertItem(dns);
    dnsdomain->setText(gpppdata.domain());
  }

  // disable buttons
  DNS_Edit_Changed("");
  remove->setEnabled(false);

  tl->activate();
}
Пример #13
0
RecurringMaster::RecurringMaster(MainWindow* main, Id recurring_id)
    : DataWindow(main, "RecurringMaster", recurring_id)
{
    _helpSource = "recurring_master.html";

    // Post button
    QPushButton* posting = new QPushButton(tr("Post"), _buttons);
    connect(posting, SIGNAL(clicked()), SLOT(slotPost()));

    // Create widgets
    QGroupBox* tx = new QGroupBox(tr("Transaction"), _frame);

    QLabel* typeLabel = new QLabel(tr("Type:"), tx);
    _type = new LineEdit(20, tx);
    _type->setFocusPolicy(NoFocus);

    QLabel* numberLabel = new QLabel(tr("Id #:"), tx);
    _number = new LineEdit(10, tx);
    _number->setFocusPolicy(NoFocus);

    QLabel* storeLabel = new QLabel(tr("Store:"), tx);
    _store = new LineEdit(tx);
    _store->setFocusPolicy(NoFocus);

    QLabel* dateLabel = new QLabel(tr("Date:"), tx);
    _date = new LineEdit(tx);
    _date->setFocusPolicy(NoFocus);

    QLabel* descLabel = new QLabel(tr("Description:"), tx);
    _desc = new LineEdit(30, tx);
    descLabel->setBuddy(_desc);

    _cardLabel = new QRadioButton(tr("Card:"), tx);
    _card = new LineEdit(tx);
    _card->setFocusPolicy(NoFocus);
    connect(_cardLabel, SIGNAL(toggled(bool)), SLOT(slotTypeChanged()));

    _groupLabel = new QRadioButton(tr("Group:"), tx);
    _groupLookup = new GroupLookup(main, this, Group::CUSTOMER);
    _group = new LookupEdit(_groupLookup, tx);
    connect(_groupLabel, SIGNAL(toggled(bool)), SLOT(slotTypeChanged()));

    QButtonGroup* types = new QButtonGroup(this);
    types->hide();
    types->insert(_cardLabel);
    types->insert(_groupLabel);

    QGridLayout* txGrid = new QGridLayout(tx);
    txGrid->setMargin(6);
    txGrid->setSpacing(6);
    txGrid->setColStretch(2, 1);
    txGrid->addRowSpacing(0, tx->fontMetrics().height());
    txGrid->addWidget(typeLabel, 1, 0);
    txGrid->addWidget(_type, 1, 1);
    txGrid->addWidget(storeLabel, 1, 3);
    txGrid->addWidget(_store, 1, 4);
    txGrid->addWidget(numberLabel, 2, 0);
    txGrid->addWidget(_number, 2, 1);
    txGrid->addWidget(dateLabel, 2, 3);
    txGrid->addWidget(_date, 2, 4);
    txGrid->addWidget(descLabel, 3, 0);
    txGrid->addMultiCellWidget(_desc, 3, 3, 1, 4);
    txGrid->addWidget(_cardLabel, 4, 0);
    txGrid->addMultiCellWidget(_card, 4, 4, 1, 4);
    txGrid->addWidget(_groupLabel, 5, 0);
    txGrid->addMultiCellWidget(_group, 5, 5, 1, 4);

    QGroupBox* freq = new QGroupBox(tr("Frequency"), _frame);

    QLabel* freqLabel = new QLabel(tr("Type:"), freq);
    _freq = new ComboBox(false, freq);
    freqLabel->setBuddy(_freq);

    _freq->insertItem(tr("Daily"));
    _freq->insertItem(tr("Weekly"));
    _freq->insertItem(tr("Bi-Weekly"));
    _freq->insertItem(tr("Semi-Monthly"));
    _freq->insertItem(tr("Monthly"));
    _freq->insertItem(tr("Quarterly"));
    _freq->insertItem(tr("Semi-Anually"));
    _freq->insertItem(tr("Anually"));
    _freq->insertItem(tr("Other"));

    QLabel* maxPostLabel = new QLabel(tr("Max Postings:"), freq);
    _maxPost = new IntegerEdit(freq);
    maxPostLabel->setBuddy(_maxPost);

    QLabel* day1Label = new QLabel(tr("Day 1:"), freq);
    _day1 = new IntegerEdit(freq);
    day1Label->setBuddy(_day1);

    QLabel* day2Label = new QLabel(tr("Day 2:"), freq);
    _day2 = new IntegerEdit(freq);
    day2Label->setBuddy(_day2);

    QGridLayout* freqGrid = new QGridLayout(freq);
    freqGrid->setMargin(6);
    freqGrid->setSpacing(6);
    freqGrid->setColStretch(2, 1);
    freqGrid->addRowSpacing(0, freq->fontMetrics().height());
    freqGrid->addWidget(freqLabel, 1, 0);
    freqGrid->addWidget(_freq, 1, 1);
    freqGrid->addWidget(maxPostLabel, 2, 0);
    freqGrid->addWidget(_maxPost, 2, 1);
    freqGrid->addWidget(day1Label, 1, 3);
    freqGrid->addWidget(_day1, 1, 4);
    freqGrid->addWidget(day2Label, 2, 3);
    freqGrid->addWidget(_day2, 2, 4);

    QGroupBox* post = new QGroupBox(tr("Postings"), _frame);

    QLabel* lastPostLabel = new QLabel(tr("Last Posted:"), post);
    _lastPost = new DatePopup(post);
    lastPostLabel->setBuddy(_lastPost);

    QLabel* nextDueLabel = new QLabel(tr("Next Due:"), post);
    _nextDue = new LineEdit(post);
    _nextDue->setFocusPolicy(NoFocus);
    nextDueLabel->setBuddy(_nextDue);

    QLabel* postCntLabel = new QLabel(tr("Posting Count:"), post);
    _postCnt = new IntegerEdit(post);
    postCntLabel->setBuddy(_postCnt);

    QLabel* overdueLabel = new QLabel(tr("Overdue Days:"), post);
    _overdue = new IntegerEdit(post);
    _overdue->setFocusPolicy(NoFocus);
    overdueLabel->setBuddy(_overdue);

    QGridLayout* postGrid = new QGridLayout(post);
    postGrid->setMargin(6);
    postGrid->setSpacing(6);
    postGrid->setColStretch(2, 1);
    postGrid->addRowSpacing(0, post->fontMetrics().height());
    postGrid->addWidget(lastPostLabel, 1, 0);
    postGrid->addWidget(_lastPost, 1, 1);
    postGrid->addWidget(nextDueLabel, 2, 0);
    postGrid->addWidget(_nextDue, 2, 1);
    postGrid->addWidget(postCntLabel, 1, 3);
    postGrid->addWidget(_postCnt, 1, 4);
    postGrid->addWidget(overdueLabel, 2, 3);
    postGrid->addWidget(_overdue, 2, 4);

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->addWidget(tx, 0, 0);
    grid->addWidget(freq, 1, 0);
    grid->addWidget(post, 2, 0);

    connect(_freq, SIGNAL(activated(int)), SLOT(slotRefresh()));

    setCaption(tr("Recurring Transaction"));
    finalize();
}
Пример #14
0
KDMGeneralWidget::KDMGeneralWidget( QWidget *parent )
	: QWidget( parent )
{
	QString wtstr;

	QBoxLayout *ml = new QVBoxLayout( this );
	ml->setSpacing( KDialog::spacingHint() );
	ml->setMargin( KDialog::marginHint() );

	QGroupBox *box = new QGroupBox( "Appearance", this );
	ml->addWidget( box );
	QGridLayout *grid = new QGridLayout( box );
	grid->setSpacing( KDialog::spacingHint() );
	grid->setMargin( KDialog::marginHint() );
	grid->setColStretch( 2, 1 );

	useThemeCheck = new QCheckBox( i18n("&Use themed greeter"), box );
	connect( useThemeCheck, SIGNAL(toggled( bool )), SLOT(slotUseThemeChanged()) );
	useThemeCheck->setWhatsThis( i18n("Enable this if you would like to use a themed Login Manager.") );
	grid->addWidget( useThemeCheck, 0, 0, 1, 2 );

	guicombo = new KBackedComboBox( box );
	guicombo->insertItem( "", i18n("<placeholder>default</placeholder>") );
	loadGuiStyles( guicombo );
	QLabel *label = new QLabel( i18n("GUI s&tyle:"), box );
	label->setBuddy( guicombo );
	connect( guicombo, SIGNAL(activated( int )), SIGNAL(changed()) );
	grid->addWidget( label, 1, 0 );
	grid->addWidget( guicombo, 1, 1 );
	wtstr = i18n("You can choose a basic GUI style here that will be "
	             "used by KDM only.");
	label->setWhatsThis( wtstr );
	guicombo->setWhatsThis( wtstr );

	colcombo = new KBackedComboBox( box );
	colcombo->insertItem( "", i18n("<placeholder>default</placeholder>") );
	loadColorSchemes( colcombo );
	label = new QLabel( i18n("Color sche&me:"), box );
	label->setBuddy( colcombo );
	connect( colcombo, SIGNAL(activated( int )), SIGNAL(changed()) );
	grid->addWidget( label, 2, 0 );
	grid->addWidget( colcombo, 2, 1 );
	wtstr = i18n("You can choose a basic Color Scheme here that will be "
	             "used by KDM only.");
	label->setWhatsThis( wtstr );
	colcombo->setWhatsThis( wtstr );

	box = new QGroupBox( "Locale", this );
	ml->addWidget( box );
	grid = new QGridLayout( box );
	grid->setSpacing( KDialog::spacingHint() );
	grid->setMargin( KDialog::marginHint() );
	grid->setColStretch( 2, 1 );

	// The Language group box
	langcombo = new KLanguageButton( box );
	langcombo->showLanguageCodes(true);
	langcombo->loadAllLanguages();
	connect( langcombo, SIGNAL(activated( const QString & )), SIGNAL(changed()) );
	label = new QLabel( i18n("&Language:"), this );
	label->setBuddy( langcombo );
	grid->addWidget( label, 0, 0 );
	grid->addWidget( langcombo, 0, 1 );
	wtstr = i18n("Here you can choose the language used by KDM. This setting does not affect"
	             " a user's personal settings; that will take effect after login.");
	label->setWhatsThis( wtstr );
	langcombo->setWhatsThis( wtstr );

	box = new QGroupBox( "Fonts", this );
	ml->addWidget( box );
	grid = new QGridLayout( box );
	grid->setSpacing( KDialog::spacingHint() );
	grid->setMargin( KDialog::marginHint() );

	label = new QLabel( i18n("&General:"), box );
	stdFontChooser = new KFontRequester( box );
	label->setBuddy( stdFontChooser );
	stdFontChooser->setWhatsThis( i18n("This changes the font which is used for all the text in the login manager except for the greeting and failure messages.") );
	connect( stdFontChooser, SIGNAL(fontSelected( const QFont& )), SIGNAL(changed()) );
	grid->addWidget( label, 0, 0 );
	grid->addWidget( stdFontChooser, 0, 1 );

	label = new QLabel( i18n("&Failure font:"), box );
	failFontChooser = new KFontRequester( box );
	label->setBuddy( failFontChooser );
	failFontChooser->setWhatsThis( i18n("This changes the font which is used for failure messages in the login manager.") );
	connect( failFontChooser, SIGNAL(fontSelected( const QFont& )), SIGNAL(changed()) );
	grid->addWidget( label, 1, 0 );
	grid->addWidget( failFontChooser, 1, 1 );

	label = new QLabel( i18n("Gree&ting:"), box );
	greetingFontChooser = new KFontRequester( box );
	label->setBuddy( greetingFontChooser );
	greetingFontChooser->setWhatsThis( i18n("This changes the font which is used for the login manager's greeting.") );
	connect( greetingFontChooser, SIGNAL(fontSelected( const QFont& )), SIGNAL(changed()) );
	grid->addWidget( label, 2, 0 );
	grid->addWidget( greetingFontChooser, 2, 1 );

	aacb = new QCheckBox( i18n("Use anti-aliasing for fonts"), box );
	aacb->setWhatsThis( i18n("If you check this box and your X-Server has the Xft extension, "
	                         "fonts will be antialiased (smoothed) in the login dialog.") );
	connect( aacb, SIGNAL(toggled( bool )), SIGNAL(changed()) );
	grid->addWidget( aacb, 3, 0, 1, 2 );

	ml->addStretch( 1 );
}
Пример #15
0
void FuturesDialog::createDetailsPage ()
{
  QWidget *w = new QWidget(this);
  
  QVBoxLayout *vbox = new QVBoxLayout(w);
  vbox->setMargin(5);
  vbox->setSpacing(0);
    
  QGridLayout *grid = new QGridLayout(vbox);
  grid->setSpacing(5);
  
  QLabel *label = new QLabel(tr("Symbol"), w);
  grid->addWidget(label, 0, 0);

  QString s;
  DBIndexItem item;
  index->getIndexItem(symbol, item);
  item.getSymbol(s);
  label = new QLabel(s, w);
  label->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
  grid->addWidget(label, 0, 1);
  
  label = new QLabel(tr("Name"), w);
  grid->addWidget(label, 1, 0);

  item.getTitle(s);  
  title = new QLineEdit(s, w);
  grid->addWidget(title, 1, 1);
  
  label = new QLabel(tr("Exchange"), w);
  grid->addWidget(label, 2, 0);

  item.getExchange(s);
  Exchange ex;
  ex.getExchange(s.toInt(), s);
  label = new QLabel(s, w);
  label->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
  grid->addWidget(label, 2, 1);
  
  label = new QLabel(tr("Type"), w);
  grid->addWidget(label, 3, 0);

  item.getType(s);  
  label = new QLabel(s, w);
  label->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
  grid->addWidget(label, 3, 1);
  
  label = new QLabel(tr("Futures Type"), w);
  grid->addWidget(label, 4, 0);
  
  QString s2;
  item.getFuturesType(s2);
  label = new QLabel(s2, w);
  label->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
  grid->addWidget(label, 4, 1);

  label = new QLabel(tr("Futures Month"), w);
  grid->addWidget(label, 5, 0);

  item.getFuturesMonth(s2);  
  label = new QLabel(s2, w);
  label->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
  grid->addWidget(label, 5, 1);
  
  label = new QLabel(tr("First Date"), w);
  grid->addWidget(label, 6, 0);
  
  Bar bar;
  db->getFirstBar(bar);
  if (! bar.getEmptyFlag())
  {
    bar.getDateTimeString(TRUE, s);
    label = new QLabel(s, w);
    label->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
    grid->addWidget(label, 6, 1);
  }
  
  label = new QLabel(tr("Last Date"), w);
  grid->addWidget(label, 7, 0);
  

  Bar bar2;
  db->getLastBar(bar2);
  if (! bar2.getEmptyFlag())
  {
    bar2.getDateTimeString(TRUE, s);
    label = new QLabel(s, w);
    label->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
    grid->addWidget(label, 7, 1);
  }
  
  grid->setColStretch(1, 1);
  vbox->insertStretch(-1, 0);
  
  addTab(w, tr("Details"));  
}
Пример #16
0
Kleo::KeyApprovalDialog::KeyApprovalDialog(const std::vector<Item> &recipients,
        const std::vector<GpgME::Key> &sender,
        QWidget *parent, const char *name,
        bool modal)
    : KDialogBase(parent, name, modal, i18n("Encryption Key Approval"), Ok | Cancel, Ok),
      d(0)
{
    assert(!recipients.empty());

    d = new Private();

    QFrame *page = makeMainWidget();
    QVBoxLayout *vlay = new QVBoxLayout(page, 0, spacingHint());

    vlay->addWidget(new QLabel(i18n("The following keys will be used for encryption:"), page));

    QScrollView *sv = new QScrollView(page);
    sv->setResizePolicy(QScrollView::AutoOneFit);
    vlay->addWidget(sv);

    QWidget *view = new QWidget(sv->viewport());

    QGridLayout *glay = new QGridLayout(view, 3, 2, marginHint(), spacingHint());
    glay->setColStretch(1, 1);
    sv->addChild(view);

    int row = -1;

    if(!sender.empty())
    {
        ++row;
        glay->addWidget(new QLabel(i18n("Your keys:"), view), row, 0);
        d->selfRequester = new EncryptionKeyRequester(true, EncryptionKeyRequester::AllProtocols, view);
        d->selfRequester->setKeys(sender);
        glay->addWidget(d->selfRequester, row, 1);
        ++row;
        glay->addMultiCellWidget(new KSeparator(Horizontal, view), row, row, 0, 1);
    }

    const QStringList prefs = preferencesStrings();

    for(std::vector<Item>::const_iterator it = recipients.begin() ; it != recipients.end() ; ++it)
    {
        ++row;
        glay->addWidget(new QLabel(i18n("Recipient:"), view), row, 0);
        glay->addWidget(new QLabel(it->address, view), row, 1);
        d->addresses.push_back(it->address);

        ++row;
        glay->addWidget(new QLabel(i18n("Encryption keys:"), view), row, 0);
        KeyRequester *req = new EncryptionKeyRequester(true, EncryptionKeyRequester::AllProtocols, view);
        req->setKeys(it->keys);
        glay->addWidget(req, row, 1);
        d->requesters.push_back(req);

        ++row;
        glay->addWidget(new QLabel(i18n("Encryption preference:"), view), row, 0);
        QComboBox *cb = new QComboBox(false, view);
        cb->insertStringList(prefs);
        glay->addWidget(cb, row, 1);
        cb->setCurrentItem(pref2cb(it->pref));
        connect(cb, SIGNAL(activated(int)), SLOT(slotPrefsChanged()));
        d->preferences.push_back(cb);
    }

    // calculate the optimal width for the dialog
    const int dialogWidth = marginHint()
                            + sv->frameWidth()
                            + view->sizeHint().width()
                            + sv->verticalScrollBar()->sizeHint().width()
                            + sv->frameWidth()
                            + marginHint()
                            + 2;
    // calculate the optimal height for the dialog
    const int dialogHeight = marginHint()
                             + fontMetrics().height()
                             + spacingHint()
                             + sv->frameWidth()
                             + view->sizeHint().height()
                             + sv->horizontalScrollBar()->sizeHint().height()
                             + sv->frameWidth()
                             + spacingHint()
                             + actionButton(KDialogBase::Cancel)->sizeHint().height()
                             + marginHint()
                             + 2;

    // don't make the dialog too large
    const QRect desk = KGlobalSettings::desktopGeometry(this);
    setInitialSize(QSize(kMin(dialogWidth, 3 * desk.width() / 4),
                         kMin(dialogHeight, 7 * desk.height() / 8)));
}
Пример #17
0
ItemTransfer::ItemTransfer(MainWindow* main, Id transfer_id)
    : DataWindow(main, "ItemTransfer", transfer_id)
{
    _helpSource = "item_transfer.html";

    // Search button
    QPushButton* search = new QPushButton(tr("Search"), _buttons);
    connect(search, SIGNAL(clicked()), SLOT(slotSearch()));

    // Get the company for deposit info
    _quasar->db()->lookup(_company);

    // Create widgets
    _gltxFrame = new GltxFrame(main, tr("Adjustment No."), _frame);
    _gltxFrame->setTitle(tr("From"));
    connect(_gltxFrame->store, SIGNAL(validData()), SLOT(slotStoreChanged()));

    _items = new Table(_frame);
    _items->setVScrollBarMode(QScrollView::AlwaysOn);
    _items->setLeftMargin(fontMetrics().width("99999"));
    _items->setDisplayRows(6);
    connect(_items, SIGNAL(cellMoved(int,int)), SLOT(cellMoved(int,int)));
    connect(_items, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(cellChanged(int,int,Variant)));
    connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(focusNext(bool&,int&,int&,int)));
    connect(_items, SIGNAL(rowInserted(int)), SLOT(rowInserted(int)));
    connect(_items, SIGNAL(rowDeleted(int)), SLOT(rowDeleted(int)));

    // Lookups
    _lookup = new ItemLookup(_main, this);
    _lookup->inventoriedOnly = true;

    // Add columns
    new LookupColumn(_items, tr("Item Number"), 18, _lookup);
    new TextColumn(_items, tr("Description"), 20);
    new TextColumn(_items, tr("Size"), 10);
    new NumberColumn(_items, tr("On Hand"), 6);
    new NumberColumn(_items, tr("Quantity"), 6);
    new MoneyColumn(_items, tr("Amount"));
    if (_company.depositAccount() != INVALID_ID)
	new MoneyColumn(_items, tr("Deposit"), 4);

    // Add editors
    _size = new QComboBox(_items);
    new LookupEditor(_items, 0, new ItemEdit(_lookup, _items));
    new ComboEditor(_items, 2, _size);
    new NumberEditor(_items, 4, new DoubleEdit(_items));
    new NumberEditor(_items, 5, new MoneyEdit(_items));
    if (_company.depositAccount() != INVALID_ID)
	new NumberEditor(_items, 6, new MoneyEdit(_items));

    QGroupBox* to = new QGroupBox(tr("To"), _frame);

    QLabel* toNumberLabel = new QLabel(tr("Adjustment No."), to);
    _toNumber = new LineEdit(9, to);
    toNumberLabel->setBuddy(_toNumber);

    QLabel* toShiftLabel = new QLabel(tr("Shift:"), to);
    _toShift = new LookupEdit(new GltxLookup(_main, this, DataObject::SHIFT),
			      to);
    _toShift->setLength(10);
    _toShift->setFocusPolicy(ClickFocus);
    toShiftLabel->setBuddy(_toShift);

    QLabel* toStoreLabel = new QLabel(tr("Store:"), to);
    _toStore = new LookupEdit(new StoreLookup(_main, this), to);
    _toStore->setLength(30);
    toStoreLabel->setBuddy(_toStore);

    QGridLayout* toGrid = new QGridLayout(to, 1, 1, to->frameWidth() * 2);
    toGrid->setSpacing(3);
    toGrid->setMargin(6);
    toGrid->setColStretch(2, 1);
    toGrid->addColSpacing(2, 10);
    toGrid->setColStretch(5, 1);
    toGrid->addColSpacing(5, 10);
    toGrid->addRowSpacing(0, to->fontMetrics().height());
    toGrid->addWidget(toNumberLabel, 1, 0);
    toGrid->addWidget(_toNumber, 1, 1, AlignLeft | AlignVCenter);
    toGrid->addWidget(toShiftLabel, 1, 3);
    toGrid->addWidget(_toShift, 1, 4, AlignLeft | AlignVCenter);
    toGrid->addWidget(toStoreLabel, 1, 6);
    toGrid->addWidget(_toStore, 1, 7, AlignLeft | AlignVCenter);

    QLabel* accountLabel = new QLabel(tr("Transfer Account:"), _frame);
    AccountLookup* lookup = new AccountLookup(main, this, 
					      Account::OtherCurLiability);
    _account = new LookupEdit(lookup, _frame);
    _account->setLength(30);
    accountLabel->setBuddy(_account);

    QLabel* totalLabel = new QLabel(tr("Transfer Amount:"), _frame);
    _total = new MoneyEdit(_frame);
    _total->setLength(14);
    _total->setFocusPolicy(NoFocus);
    totalLabel->setBuddy(_total);

    _inactive->setText(tr("Voided?"));

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(2, 1);
    grid->setRowStretch(1, 1);
    grid->addMultiCellWidget(_gltxFrame, 0, 0, 0, 4);
    grid->addMultiCellWidget(_items, 1, 1, 0, 4);
    grid->addMultiCellWidget(to, 2, 2, 0, 4);
    grid->addWidget(accountLabel, 3, 0);
    grid->addWidget(_account, 3, 1, AlignLeft | AlignVCenter);
    grid->addWidget(totalLabel, 3, 3);
    grid->addWidget(_total, 3, 4, AlignLeft | AlignVCenter);

    setCaption(tr("Item Transfer"));
    finalize();
}
Пример #18
0
// -------------------------------------------------------------------------------------------------
ParameterBox::ParameterBox(QWidget* parent, const char* name)
    throw () 
    : QFrame(parent, name), m_leftValue(-1.0), m_rightValue(-1.0)
{
    QGridLayout* layout = new QGridLayout(this, 5 /* row */, 9 /* col */, 0 /* margin */, 5);
    
    // - create ------------------------------------------------------------------------------------
    
    // settings
    Settings& set = Settings::set();
    
    // widgets
    QLabel* timeLabel = new QLabel(tr("&Measuring Time:"), this);
    QLabel* sampleLabel = new QLabel(tr("&Sampling Rate:"), this);
    QLabel* triggerLabel = new QLabel(tr("&Triggering:"), this);
    
    QTimeEdit* timeedit = new QTimeEdit(this);
    timeedit->setRange(QTime(0, 0), QTime(0, 1));
    QSlider* sampleSlider = new QSlider(0, MAX_SLIDER_VALUE, 1, 0, Qt::Horizontal, this);
    TriggerWidget* triggering = new TriggerWidget(this);
    
    // labels for the markers
    QLabel* leftMarkerLabel = new QLabel(tr("Left Button Marker:"), this);
    QLabel* rightMarkerLabel = new QLabel(tr("Right Button Marker:"), this);
    QLabel* diffLabel = new QLabel(tr("Difference:"), this);
    m_leftMarker = new QLabel(this);
    m_rightMarker = new QLabel(this);
    m_diff = new QLabel("zdddd", this);
    
    // set the font for the labels
    QFont font = qApp->font(this);
    font.setPixelSize(15);
    font.setBold(true);
    m_leftMarker->setFont(font);
    m_rightMarker->setFont(font);
    m_diff->setFont(font);
    
    // buddys
    timeLabel->setBuddy(timeedit);
    triggerLabel->setBuddy(triggering);
    sampleLabel->setBuddy(sampleSlider);
    
    // load value
    triggering->setValue(set.readNumEntry("Measuring/Triggering/Value"),
                         set.readNumEntry("Measuring/Triggering/Mask"));
    timeedit->setTime(QTime(0, set.readNumEntry("Measuring/Triggering/Minutes"),
                               set.readNumEntry("Measuring/Triggering/Seconds"))); 
    sampleSlider->setValue(MAX_SLIDER_VALUE - set.readNumEntry("Measuring/Number_Of_Skips"));
    
    // - layout the stuff --------------------------------------------------------------------------
                                   // row, col
    layout->addWidget(timeLabel,           0,    1);
    layout->addWidget(sampleLabel,         1,    1);
    layout->addWidget(triggerLabel,        2,    1,    Qt::AlignTop);
    layout->addWidget(timeedit,            0,    3);
    layout->addWidget(sampleSlider,        1,    3);
    layout->addMultiCellWidget(triggering, 2, 3, 3, 3);
    layout->addWidget(leftMarkerLabel,     0,    5);
    layout->addWidget(rightMarkerLabel,    1,    5);
    layout->addWidget(diffLabel,           2,    5);
    layout->addWidget(m_leftMarker,        0,    7,    Qt::AlignRight);
    layout->addWidget(m_rightMarker,       1,    7,    Qt::AlignRight);
    layout->addWidget(m_diff,              2,    7,    Qt::AlignRight);
    layout->setColStretch(0, 2);
    layout->setColSpacing(2, 20);
    layout->setColStretch(4, 4);
    layout->setColSpacing(6, 20);
    layout->setColSpacing(7, 150);
    layout->setColStretch(8, 2);
    
    connect(timeedit,                   SIGNAL(valueChanged(const QTime&)), 
            this,                       SLOT(timeValueChanged(const QTime&)));
    connect(triggering,                 SIGNAL(valueChanged(byte, byte)), 
            this,                       SLOT(triggerValueChanged(byte, byte)));
    connect(sampleSlider,               SIGNAL(valueChanged(int)),
            this,                       SLOT(sliderValueChanged(int)));
    
    // - initial values ----------------------------------------------------------------------------
    updateValues();
}
Пример #19
0
SessionManager::SessionManager(QWidget* parent, const char* name)
  : QWidget(parent, name)
{
  currentlyDisplayedSession = 0;
  QGridLayout* grid = new QGridLayout(this, 4, 2, 2, 2);
  preferredWidth = 200;
  grid->setColStretch(0, 1);
  grid->setColStretch(1, 1);

  scroll = new QScrollView(this);
  frame = new QFrame(scroll->viewport());
  scroll->addChild(frame);

  vBox = new QVBoxLayout(frame, 0, 2);
  vBox->setDirection(QBoxLayout::Up);

  descriptionField = new QTextEdit(this, "description");
  titleField = new QLineEdit(this, "title");
  keywordField = new QLineEdit(this, "keyword");

  selectedGeneNo = new QLineEdit("0  Genes Included", this, "selectedGeneNo");
  //  selectedGeneNo = new QLabel("0  Genes Included", this, "selectedGeneNo");

  commitChanges = new QPushButton("Commit Changes", this, "commitChanges");
  connect(commitChanges, SIGNAL(clicked()), this, SLOT(updateDescriptions()) );
  // commitChanges->setFlat(true);        // enabled if the currently displayed info is owned by the user.. hmm. let's see how we can do
  setDisableColor(commitChanges, true);

  QPushButton* updateSessions = new QPushButton("Update", this, "update");
  connect(updateSessions, SIGNAL(clicked()), this, SIGNAL(updateSessions()) );

  loadGenes = new QPushButton("Load Genes", this, "LoadGenes");
  connect(loadGenes, SIGNAL(clicked()), this, SLOT(selectGenes()) );
  setDisableColor(loadGenes, true);

  copyToSession = new QPushButton("Copy to Current Session", this, "copyToSession");
  connect(copyToSession, SIGNAL(clicked()), this, SLOT(copyIncludedGenesToCurrentSession()) );
  //copyToSession->setFlat(true);         // disabled if nothing selected,, otherwise enabled.. 
  setDisableColor(copyToSession, true);
  appendSession = new QPushButton("Append", this, "appendSession");
  connect(appendSession, SIGNAL(clicked()), this, SLOT(loadAndAppend()) );
  //appendSession->setFlat(true);         // enabled only if one is selected, and readOnly is false.. 
  setDisableColor(appendSession, true);

  grid->addMultiCellWidget(scroll, 0, 1, 1, 1);
  grid->addWidget(selectedGeneNo, 2, 1); 
  //  grid->addWidget(selectedGeneNo, 2, 1, AlignRight); 

  grid->addWidget(titleField, 0, 0);
  grid->addWidget(descriptionField, 1, 0);

  QHBoxLayout* leftBox = new QHBoxLayout();
  grid->addMultiCell(leftBox, 3, 3, 0, 1);
  leftBox->addWidget(commitChanges);
  
  // QHBoxLayout* rightBox = new QHBoxLayout();
  //grid->addLayout(rightBox, 3, 1);

  leftBox->addWidget(loadGenes);
  leftBox->addSpacing(1);
  leftBox->addWidget(copyToSession);
  leftBox->addSpacing(1);
  leftBox->addWidget(appendSession);
  leftBox->addSpacing(10);
  
  leftBox->addWidget(updateSessions);

//    rightBox->addWidget(loadGenes);
//    rightBox->addWidget(copyToSession);
//    rightBox->addWidget(appendSession);
//    rightBox->addSpacing(10);
  
//    rightBox->addWidget(updateSessions);
  
  grid->addWidget(keywordField, 2, 0);
  resize(450, 200);
}
DistributionListEditorWidget::DistributionListEditorWidget(AddressBook *addressBook, QWidget *parent) : QWidget(parent), mAddressBook(addressBook)
{
    kdDebug(5700) << "DistributionListEditor()" << endl;

    QBoxLayout *topLayout = new QVBoxLayout(this);
    topLayout->setSpacing(KDialog::spacingHint());

    QBoxLayout *nameLayout = new QHBoxLayout(topLayout);

    mNameCombo = new QComboBox(this);
    nameLayout->addWidget(mNameCombo);
    connect(mNameCombo, SIGNAL(activated(int)), SLOT(updateEntryView()));

    mNewButton = new QPushButton(i18n("New List..."), this);
    nameLayout->addWidget(mNewButton);
    connect(mNewButton, SIGNAL(clicked()), SLOT(newList()));

    mEditButton = new QPushButton(i18n("Rename List..."), this);
    nameLayout->addWidget(mEditButton);
    connect(mEditButton, SIGNAL(clicked()), SLOT(editList()));

    mRemoveButton = new QPushButton(i18n("Remove List"), this);
    nameLayout->addWidget(mRemoveButton);
    connect(mRemoveButton, SIGNAL(clicked()), SLOT(removeList()));

    QGridLayout *gridLayout = new QGridLayout(topLayout, 3, 3);
    gridLayout->setColStretch(1, 1);

    QLabel *listLabel = new QLabel(i18n("Available addresses:"), this);
    gridLayout->addWidget(listLabel, 0, 0);

    mListLabel = new QLabel(this);
    gridLayout->addMultiCellWidget(mListLabel, 0, 0, 1, 2);

    mAddresseeView = new QListView(this);
    mAddresseeView->addColumn(i18n("Name"));
    mAddresseeView->addColumn(i18n("Preferred Email"));
    mAddresseeView->setAllColumnsShowFocus(true);
    gridLayout->addWidget(mAddresseeView, 1, 0);
    connect(mAddresseeView, SIGNAL(selectionChanged()), SLOT(slotSelectionAddresseeViewChanged()));
    connect(mAddresseeView, SIGNAL(doubleClicked(QListViewItem *)), SLOT(addEntry()));

    mAddEntryButton = new QPushButton(i18n("Add Entry"), this);
    mAddEntryButton->setEnabled(false);
    gridLayout->addWidget(mAddEntryButton, 2, 0);
    connect(mAddEntryButton, SIGNAL(clicked()), SLOT(addEntry()));

    mEntryView = new QListView(this);
    mEntryView->addColumn(i18n("Name"));
    mEntryView->addColumn(i18n("Email"));
    mEntryView->addColumn(i18n("Use Preferred"));
    mEntryView->setEnabled(false);
    mEntryView->setAllColumnsShowFocus(true);
    gridLayout->addMultiCellWidget(mEntryView, 1, 1, 1, 2);
    connect(mEntryView, SIGNAL(selectionChanged()), SLOT(slotSelectionEntryViewChanged()));

    mChangeEmailButton = new QPushButton(i18n("Change Email..."), this);
    gridLayout->addWidget(mChangeEmailButton, 2, 1);
    connect(mChangeEmailButton, SIGNAL(clicked()), SLOT(changeEmail()));

    mRemoveEntryButton = new QPushButton(i18n("Remove Entry"), this);
    gridLayout->addWidget(mRemoveEntryButton, 2, 2);
    connect(mRemoveEntryButton, SIGNAL(clicked()), SLOT(removeEntry()));

    mManager = new DistributionListManager(mAddressBook);
    mManager->load();

    updateAddresseeView();
    updateNameCombo();
}
Пример #21
0
CSystemDSN::CSystemDSN( QWidget* parent, const char* name )
	: QWidget( parent, name )
{
	QVBoxLayout	*playoutTop		= new QVBoxLayout( this, 5 );
	
    QHBoxLayout	*playoutMain	= new QHBoxLayout( playoutTop );

	pDSNList = new CDSNList( this, "pDSNList" );
	pDSNList->setGeometry( 10, 10, 270, 190 );
	pDSNList->setMinimumSize( 50, 50 );
	pDSNList->setMaximumSize( 32767, 32767 );

    playoutMain->addWidget( pDSNList, 10 );

	QVBoxLayout	*playoutButtons	= new QVBoxLayout( playoutMain, 5 );

	pbAdd = new QPushButton( this, "pbAdd" );
	pbAdd->setGeometry( 290, 10, 100, 30 );
	pbAdd->setMinimumSize( 0, 0 );
	pbAdd->setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	pbAdd->setFocusPolicy( Qt::TabFocus );
	pbAdd->setBackgroundMode( Qt::PaletteBackground );
#else
	pbAdd->setFocusPolicy( QWidget::TabFocus );
	pbAdd->setBackgroundMode( QWidget::PaletteBackground );
#endif
	pbAdd->setText( "A&dd..." );
	pbAdd->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	pbAdd->setAutoResize( FALSE );
#endif

    playoutButtons->addWidget( pbAdd );

	pbRemove = new QPushButton( this, "pbRemove" );
	pbRemove->setGeometry( 290, 50, 100, 30 );
	pbRemove->setMinimumSize( 0, 0 );
	pbRemove->setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	pbRemove->setFocusPolicy( Qt::TabFocus );
	pbRemove->setBackgroundMode( Qt::PaletteBackground );
#else
	pbRemove->setFocusPolicy( QWidget::TabFocus );
	pbRemove->setBackgroundMode( QWidget::PaletteBackground );
#endif
	pbRemove->setText( "&Remove" );
	pbRemove->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	pbRemove->setAutoResize( FALSE );
#endif

    playoutButtons->addWidget( pbRemove );

	pbConfigure = new QPushButton( this, "pbConfigure" );
	pbConfigure->setGeometry( 290, 90, 100, 30 );
	pbConfigure->setMinimumSize( 0, 0 );
	pbConfigure->setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	pbConfigure->setFocusPolicy( Qt::TabFocus );
	pbConfigure->setBackgroundMode( Qt::PaletteBackground );
#else
	pbConfigure->setFocusPolicy( QWidget::TabFocus );
	pbConfigure->setBackgroundMode( QWidget::PaletteBackground );
#endif
	pbConfigure->setText( "&Configure..." );
	pbConfigure->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	pbConfigure->setAutoResize( FALSE );
#endif

    playoutButtons->addWidget( pbConfigure );

    playoutButtons->addStretch( 10 );

	QFrame *pframe;
	pframe = new QFrame( this, "Frame_2" );
	pframe->setGeometry( 10, 210, 380, 80 );
	pframe->setMinimumSize( 0, 0 );
	pframe->setMaximumSize( 32767, 32767 );
	pframe->setFrameStyle( QFrame::Box | QFrame::Raised );

    playoutTop->addWidget( pframe );
    QGridLayout *playoutHelp = new QGridLayout( pframe, 1, 2, 5 );

	QLabel* plabel1;
	plabel1 = new QLabel( pframe, "Label_1" );
	plabel1->setMinimumSize( 32, 32 );
//	plabel1->setMaximumSize( 32, 32 );
	plabel1->setPixmap( xpmDSN_System );

	QLabel* plabel2;
	plabel2 = new QLabel( pframe, "Label_2" );
	plabel2->setMinimumSize( 0, 0 );
	plabel2->setMaximumSize( 32767, 32767 );
	plabel2->setText( "System data sources are shared among all users of this machine. These data sources may also be used by system services. Only the administrator can configure system data sources." );
#ifdef QT_V4LAYOUT
	plabel2->setAlignment( Qt::AlignLeft | Qt::WordBreak );
	plabel2->setWordWrap( true );
#else
	plabel2->setAlignment( AlignLeft | WordBreak );
#endif

	playoutHelp->addWidget( plabel1, 0, 0 );
    playoutHelp->addWidget( plabel2, 0, 1 );
    playoutHelp->setColStretch( 1, 10 );

    pDSNList->Load( ODBC_SYSTEM_DSN );

	connect( pbAdd, SIGNAL(clicked()), pDSNList, SLOT(Add()) );
	connect( pbRemove, SIGNAL(clicked()), pDSNList, SLOT(Delete()) );
	connect( pbConfigure, SIGNAL(clicked()), pDSNList, SLOT(Edit()) );
#ifdef QT_V4LAYOUT
    connect( pDSNList, SIGNAL(doubleClicked( Q3ListViewItem * )), pDSNList, SLOT(DoubleClick( Q3ListViewItem * )));
#else
    connect( pDSNList, SIGNAL(doubleClicked( QListViewItem * )), pDSNList, SLOT(DoubleClick( QListViewItem * )));
#endif
}
Пример #22
0
CCredits::CCredits( QWidget* parent, const char* name )
	: QDialog( parent, name, true )
{
    setSizeGripEnabled( true );
// Qt::WStyle_Customize | Qt::WStyle_NormalBorder /*Qt::WStyle_DialogBorder*/
// Qt::WType_Dialog | Qt::WShowModal

    QGridLayout	*layoutTop  = new QGridLayout( this, 2, 1 );
    layoutTop->setSpacing( 5 );

    QListBox    *list       = new QListBox( this );

    setCaption( "unixODBC - Credits" );

    new QListBoxPixmap( list, QPixmap( xpmGreatBritain ), QString( "Nick Gorham - Current Project Lead, Driver Manager, gODBCConfig, odbctest, many fixs" ) );
    new QListBoxPixmap( list, QPixmap( xpmCanada ), QString( "Peter Harvey - Original Project Lead, support libs, ODBCConfig, DataManager, isql, odbcinst" ) );
    new QListBoxPixmap( list, QPixmap( xpmCanada ), QString( "Jon Pounder" ) );
    new QListBoxPixmap( list, QPixmap( xpmGreatBritain ), QString( "Martin Evans" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Lars Doelle" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Manush Dodunekov" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Scott Courtney" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Greg Bentz" ) );
    new QListBoxPixmap( list, QPixmap( xpmCanada ), QString( "Shandy J. Brown" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Mark Hessling" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Charles Morrison" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Holger Bischoff" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Charles Overbeck" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Murray Todd Williams" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Jim Ziegler" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Thomas Langen" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Nikolai Afanasiev" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Ralf Fassel" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Tim Roepken" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Zoltan Boszormenyi" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Murad Nayal" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Michael Koch" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Dmitriy Yusupov" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Alex Hornby" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Steve Gilbert" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Max Khon" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Jay Q. Cai" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Bill Bouma" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Steffen Dettmer" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Jens Schlegel" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Venu Anuganti" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Tomas Zellerin" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "James Dugal" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Simon Pepping" ) );

    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Bard Hustveit" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Ola Sundell" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Christian Werner" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Martin Edlman" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Dave Berry" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Holger Schurig" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Martin Ediman" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Jon Kåre Hellan" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Trond Eivind Glomsrød" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Jürgen Pfeifer" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Jason Crummack" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Bojnourdi Kaikavous" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Martin Hobbs" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Gary Bunting" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Patrice Favre" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "John C. Rood" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Martin Lacko" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Mikko Vierula" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Paul Richardson" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Samuel Cote" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Christian Jullien" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Mark Vanderwiel" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Jeff Garzik" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Keith Woodard" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Steven M. Schultz" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Joel W. Reed" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Jay Van Vark" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Rick Flower" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Artiom Morozov" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Bill Medland" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Per I. Mathisen" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Emile Heitor" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "John L Miller" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Brian Harris" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Craig A Berry" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Stefan Radman" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Jay Cai" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Steve Langasek" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "Stuart Coupe" ) );
    new QListBoxPixmap( list, QPixmap( xpmNoFlag ), QString( "David Brown" ) );

    layoutTop->addWidget( list, 0, 0 );
    layoutTop->setRowStretch( 0, 10 );

    //
	QGridLayout	*layoutButtons = new QGridLayout( layoutTop, 1, 2 );
    layoutButtons->setSpacing( 5 );
    layoutButtons->setMargin( 5 );
    QPushButton *ppushbuttonOk = new QPushButton( "Ok", this );
    layoutButtons->addWidget( ppushbuttonOk, 0, 1 );
    layoutButtons->setColStretch( 0, 10 );

    connect( ppushbuttonOk, SIGNAL(clicked()), SLOT(accept()) );

    resize( 600, 300 );
}
Пример #23
0
QWidget* CombatWindow::initOffenseWidget()
{
	// Create the list view widget
	m_offenseListView = new SEQListView(preferenceName());
	m_offenseListView->addColumn("Type");
	m_offenseListView->setColumnAlignment(0, Qt::AlignRight);
	m_offenseListView->addColumn("Hit");
	m_offenseListView->setColumnAlignment(1, Qt::AlignRight);
	m_offenseListView->addColumn("Miss");
	m_offenseListView->setColumnAlignment(2, Qt::AlignRight);
	m_offenseListView->addColumn("Ratio");
	m_offenseListView->setColumnAlignment(3, Qt::AlignRight);
	m_offenseListView->addColumn("Avg");
	m_offenseListView->setColumnAlignment(4, Qt::AlignRight);
	m_offenseListView->addColumn("Min");
	m_offenseListView->setColumnAlignment(5, Qt::AlignRight);
	m_offenseListView->addColumn("Max");
	m_offenseListView->setColumnAlignment(6, Qt::AlignRight);
	m_offenseListView->addColumn("Total");
	m_offenseListView->setColumnAlignment(7, Qt::AlignRight);
	m_offenseListView->restoreColumns();
	m_offenseListView->setMinimumSize(m_offenseListView->sizeHint().width(), 200);

	// lay out the widgets in a grid
	QGridLayout *summaryGrid = new QGridLayout();

	// Total damage
	summaryGrid->addWidget(new QLabel("Total Damage:"), 0, 0);
	m_offenseTotalDamage = new QLabel();
	summaryGrid->addWidget(m_offenseTotalDamage, 0, 1);

	// Average melee
	summaryGrid->addWidget(new QLabel("Avg Melee:"), 0, 2);
	m_offenseAvgMelee = new QLabel();
	summaryGrid->addWidget(m_offenseAvgMelee, 0, 3);

	// % from special
	summaryGrid->addWidget(new QLabel("% from Special:"), 1, 0);
	m_offensePercentSpecial = new QLabel();
	summaryGrid->addWidget(m_offensePercentSpecial, 1, 1);

	// Avg Special
	summaryGrid->addWidget(new QLabel("Avg Special:"), 1, 2);
	m_offenseAvgSpecial = new QLabel();
	summaryGrid->addWidget(m_offenseAvgSpecial, 1, 3);

	// % from non melee
	summaryGrid->addWidget(new QLabel("% from NonMelee:"), 2, 0);
	m_offensePercentNonMelee = new QLabel();
	summaryGrid->addWidget(m_offensePercentNonMelee, 2, 1);

	// Avg non melee
	summaryGrid->addWidget(new QLabel("Avg NonMelee:"), 2, 2);
	m_offenseAvgNonMelee = new QLabel();
	summaryGrid->addWidget(m_offenseAvgNonMelee, 2, 3);

	summaryGrid->setColStretch(1, 1);
	summaryGrid->setColStretch(3, 1);
	summaryGrid->setSpacing(5);

	QGroupBox* summaryWidget = new QGroupBox("Summary");
	summaryWidget->setLayout(summaryGrid);

	m_offenseLayout = new QVBoxLayout();
	m_offenseLayout->addWidget(m_offenseListView);
	m_offenseLayout->addWidget(summaryWidget);

	QWidget* layoutWidget = new QWidget();
	layoutWidget->setLayout(m_offenseLayout);

	return layoutWidget;
}
Пример #24
0
K3bDataPropertiesDialog::K3bDataPropertiesDialog( K3bDataItem* dataItem, QWidget* parent, const char* name )
  : KDialogBase( Plain, i18n("File Properties"), Ok|Cancel, Ok, parent, name, true, false )
{
  m_dataItem = dataItem;

  QLabel* labelMimeType = new QLabel( plainPage() );
  QLabel* extraInfoLabel = new QLabel( plainPage() );
  m_editName = new KLineEdit( plainPage() );
  m_labelType = new QLabel( plainPage() );
  m_labelLocation = new KCutLabel( plainPage() );
  m_labelSize = new QLabel( plainPage() );
  m_labelBlocks = new QLabel( plainPage() );
  m_labelLocalName = new KCutLabel( plainPage() );
  m_labelLocalLocation = new KCutLabel( plainPage() );


  QGridLayout* grid = new QGridLayout( plainPage() );
  grid->setSpacing( spacingHint() );
  grid->setMargin( marginHint() );

  grid->addWidget( labelMimeType, 0, 0 );
  grid->addWidget( m_editName, 0, 2 );
  QFrame* line = new QFrame( plainPage() );
  line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
  grid->addMultiCellWidget( line, 1, 1, 0, 2 );
  grid->addWidget( new QLabel( i18n("Type:"), plainPage() ), 2, 0 );
  grid->addWidget( new QLabel( i18n("Location:"), plainPage() ), 4, 0 );
  grid->addWidget( new QLabel( i18n("Size:"), plainPage() ), 5, 0 );
  grid->addWidget( new QLabel( i18n("Used blocks:"), plainPage() ), 6, 0 );
  grid->addWidget( m_labelType, 2, 2 );
  grid->addWidget( extraInfoLabel, 3, 2 );
  grid->addWidget( m_labelLocation, 4, 2 );
  grid->addWidget( m_labelSize, 5, 2 );
  grid->addWidget( m_labelBlocks, 6, 2 );
  line = new QFrame( plainPage() );
  line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
  grid->addMultiCellWidget( line, 7, 7, 0, 2 );
  QLabel* label1 = new QLabel( i18n("Local name:"), plainPage() );
  grid->addWidget(  label1, 8, 0 );
  QLabel* label2 = new QLabel( i18n("Local location:"), plainPage() );
  grid->addWidget( label2, 9, 0 );
  grid->addWidget( m_labelLocalName, 8, 2 );
  grid->addWidget( m_labelLocalLocation, 9, 2 );

  grid->addColSpacing( 1, 50 );
  grid->setColStretch( 2, 1 );



  if( K3bFileItem* fileItem = dynamic_cast<K3bFileItem*>(dataItem) ) {
    KFileItem kFileItem( KFileItem::Unknown, KFileItem::Unknown, KURL::fromPathOrURL(fileItem->localPath()) );
    labelMimeType->setPixmap( kFileItem.pixmap(KIcon::SizeLarge) );
    if( fileItem->isSymLink() )
      m_labelType->setText( i18n("Link to %1").arg(kFileItem.mimeComment()) );
    else
      m_labelType->setText( kFileItem.mimeComment() );
    m_labelLocalName->setText( kFileItem.name() );
    QString localLocation = kFileItem.url().path(-1);
    localLocation.truncate( localLocation.findRev('/') );
    m_labelLocalLocation->setText( localLocation );
    m_labelSize->setText( KIO::convertSize(dataItem->size()) );
  }
  else if( K3bDirItem* dirItem = dynamic_cast<K3bDirItem*>(dataItem) ) {
    labelMimeType->setPixmap( KMimeType::pixmapForURL( KURL( "/" )) );
    m_labelType->setText( i18n("Directory") );
    label1->hide();
    label2->hide();
    m_labelLocalName->hide();
    m_labelLocalLocation->hide();
    line->hide();
    m_labelSize->setText( KIO::convertSize(dataItem->size()) + "\n(" +
			  i18n("in 1 file", "in %n files", dirItem->numFiles()) + " " +
			  i18n("and 1 directory", "and %n directories", dirItem->numDirs()) + ")" );
  }
  else {
    labelMimeType->setPixmap( DesktopIcon("unknown", KIcon::SizeLarge) );
    m_labelType->setText( i18n("Special file") );
    m_labelLocalName->hide();
    m_labelLocalLocation->hide();
    label1->hide();
    label2->hide();
    line->hide();
    m_labelSize->setText( KIO::convertSize(dataItem->size()) );
  }

  m_editName->setText( dataItem->k3bName() );
  m_labelBlocks->setText( QString::number(dataItem->blocks().lba()) );

  QString location = "/" + dataItem->k3bPath();
  if( location[location.length()-1] == '/' )
    location.truncate( location.length()-1 );
  location.truncate( location.findRev('/') );
  if( location.isEmpty() )
    location = "/";
  m_labelLocation->setText( location );
  extraInfoLabel->setText( QString( "(%1)" ).arg(dataItem->extraInfo()) );
  if( dataItem->extraInfo().isEmpty() )
    extraInfoLabel->hide();

  // OPTIONS
  // /////////////////////////////////////////////////
  QTabWidget* optionTab = new QTabWidget( plainPage() );
  line = new QFrame( plainPage() );
  line->setFrameStyle( QFrame::HLine | QFrame::Sunken );

  grid->addMultiCellWidget( line, 10, 10, 0, 2 );
  grid->addMultiCellWidget( optionTab, 12, 12, 0, 2 );
  grid->setRowStretch( 11, 1 );

  QWidget* hideBox = new QWidget( optionTab );
  QGridLayout* hideBoxGrid = new QGridLayout( hideBox );
  hideBoxGrid->setSpacing( spacingHint() );
  hideBoxGrid->setMargin( marginHint() );
  m_checkHideOnRockRidge = new QCheckBox( i18n("Hide on Rockridge"), hideBox );
  m_checkHideOnJoliet = new QCheckBox( i18n("Hide on Joliet"), hideBox );
  hideBoxGrid->addWidget( m_checkHideOnRockRidge, 0, 0 );
  hideBoxGrid->addWidget( m_checkHideOnJoliet, 1, 0 );
  hideBoxGrid->setRowStretch( 2, 1 );
//   grid->addMultiCellWidget( m_checkHideOnRockRidge, 10, 10, 0, 2 );
//   grid->addMultiCellWidget( m_checkHideOnJoliet, 11, 11, 0, 2 );

  QWidget* sortingBox = new QWidget( optionTab );
  QGridLayout* sortingBoxGrid = new QGridLayout( sortingBox );
  sortingBoxGrid->setSpacing( spacingHint() );
  sortingBoxGrid->setMargin( marginHint() );
  m_editSortWeight = new KLineEdit( sortingBox );
  m_editSortWeight->setValidator( new QIntValidator( -2147483647, 2147483647, m_editSortWeight ) );
  m_editSortWeight->setAlignment( Qt::AlignRight );
  sortingBoxGrid->addWidget( new QLabel( i18n("Sort weight:"), sortingBox ), 0, 0 );
  sortingBoxGrid->addWidget( m_editSortWeight, 0, 1 );
  sortingBoxGrid->setColStretch( 1, 1 );
  sortingBoxGrid->setRowStretch( 1, 1 );

  optionTab->addTab( hideBox, i18n("Settings") );
  optionTab->addTab( sortingBox, i18n("Advanced") );


  m_checkHideOnJoliet->setChecked( dataItem->hideOnJoliet() );
  m_checkHideOnRockRidge->setChecked( dataItem->hideOnRockRidge() );
  m_editSortWeight->setText( QString::number(dataItem->sortWeight()) );

  // if the parent is hidden the value cannot be changed (see K3bDataItem::setHide...)
  if( dataItem->parent() ) {
    m_checkHideOnRockRidge->setDisabled( dataItem->parent()->hideOnRockRidge() );
    m_checkHideOnJoliet->setDisabled( dataItem->parent()->hideOnJoliet() );
  }

  if( !dataItem->isHideable() ) {
    m_checkHideOnJoliet->setDisabled(true);
    m_checkHideOnRockRidge->setDisabled(true);
    //    line->hide();
  }

  QToolTip::add( m_checkHideOnRockRidge, i18n("Hide this file in the RockRidge filesystem") );
  QToolTip::add( m_checkHideOnJoliet, i18n("Hide this file in the Joliet filesystem") );
  QToolTip::add( m_editSortWeight, i18n("Modify the physical sorting") );
  QWhatsThis::add( m_checkHideOnRockRidge, i18n("<p>If this option is checked, the file or directory "
						"(and its entire contents) will be hidden on the "
						"ISO9660 and RockRidge filesystem.</p>"
						"<p>This is useful, for example, for having different README "
						"files for RockRidge and Joliet, which can be managed "
						"by hiding README.joliet on RockRidge and README.rr "
						"on the Joliet filesystem.</p>") );
  QWhatsThis::add( m_checkHideOnJoliet, i18n("<p>If this option is checked, the file or directory "
					     "(and its entire contents) will be hidden on the "
					     "Joliet filesystem.</p>"
					     "<p>This is useful, for example, for having different README "
					     "files for RockRidge and Joliet, which can be managed "
					     "by hiding README.joliet on RockRidge and README.rr "
					     "on the Joliet filesystem.</p>") );
  QWhatsThis::add( m_editSortWeight, i18n("<p>This value modifies the physical sort order of the files "
					  "in the ISO9660 filesystem. A higher weighting means that the "
					  "file will be located closer to the beginning of the image "
					  "(and the disk)."
					  "<p>This option is useful in order to optimize the data layout "
					  "on a CD/DVD."
					  "<p><b>Caution:</b> This does not sort the order of the file "
					  "names that appear in the ISO9660 directory."
					  "It sorts the order in which the file data is "
					  "written to the image.") );

  m_editName->setValidator( K3bValidators::iso9660Validator( false, this ) );
  m_editName->setReadOnly( !dataItem->isRenameable() );
  m_editName->setFocus();
}
Пример #25
0
SubdeptMaster::SubdeptMaster(MainWindow* main, Id subdept_id)
    : DataWindow(main, "SubdeptMaster", subdept_id)
{
    _helpSource = "subdept_master.html";

    // Create widgets
    QLabel* nameLabel = new QLabel(tr("&Name:"), _frame);
    _name = new LineEdit(30, _frame);
    nameLabel->setBuddy(_name);

    QLabel* numberLabel = new QLabel(tr("Number:"), _frame);
    _number = new LineEdit(5, _frame);
    numberLabel->setBuddy(_number);

    QLabel* deptLabel = new QLabel(tr("&Department:"), _frame);
    _dept = new LookupEdit(new DeptLookup(main, this), _frame);
    _dept->setLength(30);
    deptLabel->setBuddy(_dept);

    QGroupBox* flags = new QGroupBox(tr("Type"), _frame);
    QGridLayout* f_grid = new QGridLayout(flags, 2, 2,
					  flags->frameWidth() * 2);
    f_grid->addRowSpacing(0, flags->fontMetrics().height());

    _purchased = new QCheckBox(tr("Purchased?"), flags);
    _sold = new QCheckBox(tr("Sold?"), flags);
    _inventoried = new QCheckBox(tr("Inventoried?"), flags);

    _expenseLabel = new QLabel(tr("COGS Account:"), flags);
    _expenseLookup = new AccountLookup(main, this, Account::COGS);
    _expense_acct = new LookupEdit(_expenseLookup, flags);
    _expense_acct->setLength(30);
    _expenseLabel->setBuddy(_expense_acct);

    QLabel* incomeLabel = new QLabel(tr("Income Account:"), flags);
    AccountLookup* il = new AccountLookup(main, this, Account::Income);
    _income_acct = new LookupEdit(il, flags);
    _income_acct->setLength(30);
    incomeLabel->setBuddy(_income_acct);

    QLabel* assetLabel = new QLabel(tr("Asset Account:"), flags);
    AccountLookup* al = new AccountLookup(main, this, Account::Inventory);
    _asset_acct = new LookupEdit(al, flags);
    _asset_acct->setLength(30);
    assetLabel->setBuddy(_asset_acct);

    connect(_purchased, SIGNAL(toggled(bool)), SLOT(flagsChanged()));
    connect(_sold, SIGNAL(toggled(bool)), SLOT(flagsChanged()));
    connect(_inventoried, SIGNAL(toggled(bool)), SLOT(flagsChanged()));

    f_grid->setColStretch(1, 1);
    f_grid->addWidget(_purchased, 1, 0, AlignLeft | AlignVCenter);
    f_grid->addWidget(_sold, 2, 0, AlignLeft | AlignVCenter);
    f_grid->addWidget(_inventoried, 3, 0, AlignLeft | AlignVCenter);
    f_grid->addWidget(_expenseLabel, 1, 1, AlignRight | AlignVCenter);
    f_grid->addWidget(_expense_acct, 1, 2, AlignLeft | AlignVCenter);
    f_grid->addWidget(incomeLabel, 2, 1, AlignRight | AlignVCenter);
    f_grid->addWidget(_income_acct, 2, 2, AlignLeft | AlignVCenter);
    f_grid->addWidget(assetLabel, 3, 1, AlignRight | AlignVCenter);
    f_grid->addWidget(_asset_acct, 3, 2, AlignLeft | AlignVCenter);

    QHBox* box = new QHBox(_frame);
    box->setSpacing(3);

    QGroupBox* purchase = new QGroupBox(tr("Purchase Information"), box);
    QGridLayout* p_grid = new QGridLayout(purchase, 2, 2,
					  purchase->frameWidth() * 2);
    p_grid->addRowSpacing(0, purchase->fontMetrics().height());

    QLabel* purchLabel = new QLabel(tr("Purchase Tax:"), purchase);
    _purch_tax = new LookupEdit(new TaxLookup(main, this), purchase);
    _purch_tax->setLength(6);
    purchLabel->setBuddy(_purch_tax);

    p_grid->setColStretch(1, 1);
    p_grid->setRowStretch(3, 1);
    p_grid->addWidget(purchLabel, 1, 0, AlignLeft | AlignVCenter);
    p_grid->addWidget(_purch_tax, 1, 1, AlignLeft | AlignVCenter);

    QGroupBox* sales = new QGroupBox(tr("Sales Information"), box);
    QGridLayout* s_grid = new QGridLayout(sales, 2, 2,
					  sales->frameWidth() * 2);
    s_grid->addRowSpacing(0, sales->fontMetrics().height());

    QLabel* targetLabel = new QLabel(tr("Target GM:"), sales);
    _target_gm = new PercentEdit(sales);
    _target_gm->setLength(10);
    targetLabel->setBuddy(_target_gm);

    QLabel* allowLabel = new QLabel(tr("Variance:"), sales);
    _allowed_var = new PercentEdit(sales);
    _allowed_var->setLength(10);
    allowLabel->setBuddy(_allowed_var);

    QLabel* sellLabel = new QLabel(tr("Selling Tax:"), sales);
    _sell_tax = new LookupEdit(new TaxLookup(main, this), sales);
    _sell_tax->setLength(6);
    sellLabel->setBuddy(_sell_tax);

    _discountable = new QCheckBox(tr("Discountable?"), sales);

    s_grid->setRowStretch(3, 1);
    s_grid->setColStretch(1, 1);
    s_grid->addWidget(targetLabel, 1, 0, AlignLeft | AlignVCenter);
    s_grid->addWidget(_target_gm, 1, 1, AlignLeft | AlignVCenter);
    s_grid->addWidget(allowLabel, 1, 2, AlignLeft | AlignVCenter);
    s_grid->addWidget(_allowed_var, 1, 3, AlignLeft | AlignVCenter);
    s_grid->addWidget(sellLabel, 2, 0, AlignLeft | AlignVCenter);
    s_grid->addWidget(_sell_tax, 2, 1, AlignLeft | AlignVCenter);
    s_grid->addMultiCellWidget(_discountable, 2, 2, 2, 3,
			       AlignLeft | AlignVCenter);

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setMargin(3);
    grid->setSpacing(3);
    grid->setColStretch(2, 1);
    grid->addWidget(nameLabel, 0, 0);
    grid->addWidget(_name, 0, 1, AlignLeft | AlignVCenter);
    grid->addWidget(numberLabel, 0, 3);
    grid->addWidget(_number, 0, 4, AlignLeft | AlignVCenter);
    grid->addWidget(deptLabel, 1, 0);
    grid->addWidget(_dept, 1, 1, AlignLeft | AlignVCenter);
    grid->addMultiCellWidget(flags, 2, 2, 0, 4);
    grid->addMultiCellWidget(box, 3, 3, 0, 4);

    setCaption(tr("Subdepartment Master"));
    finalize();
}
Пример #26
0
K3bWriterSelectionWidget::K3bWriterSelectionWidget( QWidget *parent, const char *name )
  : QWidget( parent, name )
{
  d = new Private;
  d->forceAutoSpeed = false;
  d->supportedWritingApps = K3b::CDRECORD|K3b::CDRDAO|K3b::GROWISOFS;
  d->lastSetSpeed = -1;

  QGroupBox* groupWriter = new QGroupBox( this );
  groupWriter->setTitle( i18n( "Burn Medium" ) );
  groupWriter->setColumnLayout(0, Qt::Vertical );
  groupWriter->layout()->setSpacing( 0 );
  groupWriter->layout()->setMargin( 0 );

  QGridLayout* groupWriterLayout = new QGridLayout( groupWriter->layout() );
  groupWriterLayout->setAlignment( Qt::AlignTop );
  groupWriterLayout->setSpacing( KDialog::spacingHint() );
  groupWriterLayout->setMargin( KDialog::marginHint() );

  QLabel* labelSpeed = new QLabel( groupWriter, "TextLabel1" );
  labelSpeed->setText( i18n( "Speed:" ) );

  m_comboSpeed = new KComboBox( false, groupWriter, "m_comboSpeed" );
  m_comboSpeed->setAutoMask( false );
  m_comboSpeed->setDuplicatesEnabled( false );

  m_comboMedium = new MediaSelectionComboBox( groupWriter );

  m_writingAppLabel = new QLabel( i18n("Writing app:"), groupWriter );
  m_comboWritingApp = new KComboBox( groupWriter );

  groupWriterLayout->addWidget( m_comboMedium, 0, 0 );
  groupWriterLayout->addWidget( labelSpeed, 0, 1 );
  groupWriterLayout->addWidget( m_comboSpeed, 0, 2 );
  groupWriterLayout->addWidget( m_writingAppLabel, 0, 3 );
  groupWriterLayout->addWidget( m_comboWritingApp, 0, 4 );
  groupWriterLayout->setColStretch( 0, 1 );


  QGridLayout* mainLayout = new QGridLayout( this );
  mainLayout->setAlignment( Qt::AlignTop );
  mainLayout->setSpacing( KDialog::spacingHint() );
  mainLayout->setMargin( 0 );

  mainLayout->addWidget( groupWriter, 0, 0 );

  // tab order
  setTabOrder( m_comboMedium, m_comboSpeed );
  setTabOrder( m_comboSpeed, m_comboWritingApp );

  connect( m_comboMedium, SIGNAL(selectionChanged(K3bDevice::Device*)), this, SIGNAL(writerChanged()) );
  connect( m_comboMedium, SIGNAL(selectionChanged(K3bDevice::Device*)),
	   this, SIGNAL(writerChanged(K3bDevice::Device*)) );
  connect( m_comboMedium, SIGNAL(newMedia()), this, SIGNAL(newMedia()) );
  connect( m_comboMedium, SIGNAL(newMedium(K3bDevice::Device*)), this, SIGNAL(newMedium(K3bDevice::Device*)) );
  connect( m_comboMedium, SIGNAL(newMedium(K3bDevice::Device*)), this, SLOT(slotNewBurnMedium(K3bDevice::Device*)) );
  connect( m_comboWritingApp, SIGNAL(activated(int)), this, SLOT(slotWritingAppSelected(int)) );
  connect( this, SIGNAL(writerChanged()), SLOT(slotWriterChanged()) );
  connect( m_comboSpeed, SIGNAL(activated(int)), this, SLOT(slotSpeedChanged(int)) );


  QToolTip::add( m_comboMedium, i18n("The medium that will be used for burning") );
  QToolTip::add( m_comboSpeed, i18n("The speed at which to burn the medium") );
  QToolTip::add( m_comboWritingApp, i18n("The external application to actually burn the medium") );

  QWhatsThis::add( m_comboMedium, i18n("<p>Select the medium that you want to use for burning."
				       "<p>In most cases there will only be one medium available which "
				       "does not leave much choice.") );
  QWhatsThis::add( m_comboSpeed, i18n("<p>Select the speed with which you want to burn."
				      "<p><b>Auto</b><br>"
				      "This will choose the maximum writing speed possible with the used "
				      "medium. "
				      "This is the recommended selection for most media.</p>"
				      "<p><b>Ignore</b> (DVD only)<br>"
				      "This will leave the speed selection to the writer device. "
				      "Use this if K3b is unable to set the writing speed."
				      "<p>1x refers to 1385 KB/s for DVD and 175 KB/s for CD.</p>"
				      "<p><b>Caution:</b> Make sure your system is able to send the data "
				      "fast enough to prevent buffer underruns.") );
  QWhatsThis::add( m_comboWritingApp, i18n("<p>K3b uses the command line tools cdrecord, growisofs, and cdrdao "
					   "to actually write a CD or DVD."
					   "<p>Normally K3b chooses the best "
					   "suited application for every task automatically but in some cases it "
					   "may be possible that one of the applications does not work as intended "
					   "with a certain writer. In this case one may select the "
					   "application manually.") );

  clearSpeedCombo();

  slotConfigChanged(k3bcore->config());
  slotWriterChanged();
}
Пример #27
0
OptionsDialog::OptionsDialog(QWidget *parent, const char *name)
  : KDialogBase(IconList, i18n("Configure"), Help|Default|Ok|Apply|Cancel, Ok, parent, name, false, true)
{

  //******** Server ************************************
  serverTab = addPage(i18n("Server"),i18n("DICT Server Configuration"), BarIcon("network", KIcon::SizeMedium ));
  QGridLayout* grid = new QGridLayout(serverTab,10,3,0,spacingHint());

  w_server = new KLineEdit(serverTab);
  w_server->setText(global->server);
  QLabel *l = new QLabel(w_server, i18n("Host&name:"), serverTab);
  grid->addWidget(l,0,0);
  grid->addMultiCellWidget(w_server,0,0,1,2);
  connect( w_server, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotChanged() ) );

  w_port = new KLineEdit(serverTab);
  w_port->setValidator(new KIntValidator(0,65536,this));
  w_port->setText(QString::number(global->port));
  l = new QLabel(w_port, i18n("&Port:"), serverTab);
  grid->addWidget(l,1,0);
  grid->addWidget(w_port,1,1);
  connect( w_port, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotChanged() ) );

  w_idleHold = new KIntSpinBox(0,300,5,0,10,serverTab);
  w_idleHold->setSuffix(i18n(" sec"));
  w_idleHold->setValue(global->idleHold);
  l = new QLabel(w_idleHold, i18n("Hold conn&ection for:"), serverTab);
  grid->addWidget(l,2,0);
  grid->addWidget(w_idleHold,2,1);
  connect( w_idleHold, SIGNAL( valueChanged(int) ), this, SLOT( slotChanged() ) );

  w_timeout = new KIntSpinBox(5,600,5,5,10,serverTab);
  w_timeout->setSuffix(i18n(" sec"));
  w_timeout->setValue(global->timeout);
  l = new QLabel(w_timeout, i18n("T&imeout:"), serverTab);
  grid->addWidget(l,3,0);
  grid->addWidget(w_timeout,3,1);
  connect( w_timeout, SIGNAL( valueChanged(int) ), this, SLOT( slotChanged() ) );

  w_pipesize = new KIntSpinBox(100,5000,2,2,10,serverTab);
  w_pipesize->setSuffix(i18n(" bytes"));
  w_pipesize->setValue(global->pipeSize);
  l = new QLabel(w_pipesize, i18n("Command &buffer:"), serverTab);
  grid->addWidget(l,4,0);
  grid->addWidget(w_pipesize,4,1);
  connect( w_pipesize, SIGNAL( valueChanged(int) ), this, SLOT( slotChanged() ) );

  QStringList encodingNames = KGlobal::charsets()->descriptiveEncodingNames();
  int i=0,x=0;
  for ( QStringList::Iterator it = encodingNames.begin(); it != encodingNames.end(); ++it ) {
    if (KGlobal::charsets()->encodingForName(*it)==global->encoding) {
      x = i;
      break;
    }
    i++;
  }
  w_encoding = new QComboBox(serverTab);
  w_encoding->insertStringList(encodingNames);
  w_encoding->setCurrentItem(x);
  l = new QLabel(w_encoding, i18n("Encod&ing:"), serverTab);
  grid->addWidget(l,5,0);
  grid->addMultiCellWidget(w_encoding,5,5,1,2);
  connect( w_encoding, SIGNAL( activated(int) ), this, SLOT( slotChanged() ) );

  w_auth = new QCheckBox(i18n("Server requires a&uthentication"),serverTab);
  w_auth->setChecked(global->authEnabled);
  grid->addMultiCellWidget(w_auth,6,6,0,2);
  connect( w_auth, SIGNAL( toggled(bool) ), this, SLOT( slotChanged() ) );
  connect(w_auth,SIGNAL(toggled(bool)),SLOT(slotAuthRequiredToggled(bool)));

  w_user = new KLineEdit(serverTab);
  w_user->setText(global->user);
  l_user = new QLabel(w_user, i18n("U&ser:"),serverTab);
  grid->addWidget(l_user,7,0);
  grid->addMultiCellWidget(w_user,7,7,1,2);
  connect( w_user, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotChanged() ) );

  w_secret = new KLineEdit(serverTab);
  w_secret->setEchoMode(QLineEdit::Password);
  w_secret->setText(global->secret);
  l_secret = new QLabel(w_secret, i18n("Pass&word:"), serverTab);
  grid->addWidget(l_secret,8,0);
  grid->addMultiCellWidget(w_secret,8,8,1,2);
  connect( w_secret, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotChanged() ) );

  slotAuthRequiredToggled( w_auth->isChecked() );

  grid->setColStretch(1,2);
  grid->setColStretch(2,2);

  //************ Appearance ***************************
  appTab = addPage(i18n("Appearance"),i18n("Customize Visual Appearance"), BarIcon("appearance", KIcon::SizeMedium ));

  QGridLayout *topL=new QGridLayout(appTab, 8, 3, 0, spacingHint());

  //color-list
  c_List = new DialogListBox(false, appTab);
  topL->addMultiCellWidget(c_List,1,3,0,1);
  connect(c_List, SIGNAL(selected(QListBoxItem*)),SLOT(slotColItemSelected(QListBoxItem*)));
  connect(c_List, SIGNAL(selectionChanged()), SLOT(slotColSelectionChanged()));

  c_olorCB = new QCheckBox(i18n("&Use custom colors"),appTab);
  topL->addWidget(c_olorCB,0,0);
  connect(c_olorCB, SIGNAL(toggled(bool)), this, SLOT(slotColCheckBoxToggled(bool)));
  connect(c_olorCB, SIGNAL(toggled(bool) ), this, SLOT( slotChanged()));

  c_olChngBtn=new QPushButton(i18n("Cha&nge..."), appTab);
  connect(c_olChngBtn, SIGNAL(clicked()), SLOT(slotColChangeBtnClicked()));
  topL->addWidget(c_olChngBtn,1,2);

  c_olDefBtn=new QPushButton(i18n("Default&s"), appTab);
  connect(c_olDefBtn, SIGNAL(clicked()), SLOT(slotColDefaultBtnClicked()));
  topL->addWidget(c_olDefBtn,2,2);
  connect(c_olDefBtn, SIGNAL(clicked()), SLOT(slotChanged()));

  //font-list
  f_List = new DialogListBox(false, appTab);
  topL->addMultiCellWidget(f_List,5,7,0,1);
  connect(f_List, SIGNAL(selected(QListBoxItem*)),SLOT(slotFontItemSelected(QListBoxItem*)));
  connect(f_List, SIGNAL(selectionChanged()),SLOT(slotFontSelectionChanged()));

  f_ontCB = new QCheckBox(i18n("Use custom &fonts"),appTab);
  topL->addWidget(f_ontCB,4,0);
  connect(f_ontCB, SIGNAL(toggled(bool)), SLOT(slotFontCheckBoxToggled(bool)));
  connect(f_ontCB, SIGNAL(toggled(bool)), SLOT(slotChanged()));

  f_ntChngBtn=new QPushButton(i18n("Chang&e..."), appTab);
  connect(f_ntChngBtn, SIGNAL(clicked()), SLOT(slotFontChangeBtnClicked()));
  topL->addWidget(f_ntChngBtn,5,2);

  f_ntDefBtn=new QPushButton(i18n("Defaul&ts"), appTab);
  connect(f_ntDefBtn, SIGNAL(clicked()), SLOT(slotFontDefaultBtnClicked()));
  topL->addWidget(f_ntDefBtn,6,2);
  connect(f_ntDefBtn, SIGNAL(clicked()), SLOT(slotChanged()));

  topL->setColStretch(1,2);
  topL->setColStretch(2,0);
  topL->setRowStretch(3,1);
  topL->setRowStretch(7,1);
  topL->setResizeMode(QLayout::Minimum);

  //init
  c_olorCB->setChecked(global->useCustomColors);
  slotColCheckBoxToggled(global->useCustomColors);
  for(int i=0; i<global->colorCount(); i++)
    c_List->insertItem(new ColorListItem(global->colorName(i), global->color(i)));

  f_ontCB->setChecked(global->useCustomFonts);
  slotFontCheckBoxToggled(global->useCustomFonts);
  for(int i=0; i<global->fontCount(); i++)
    f_List->insertItem(new FontListItem(global->fontName(i), global->font(i)));

  //************ Layout ***************************
  layoutTab = addPage(i18n("Layout"),i18n("Customize Output Format"), BarIcon("text_left", KIcon::SizeMedium ));

  QVBoxLayout *vbox = new QVBoxLayout(layoutTab, 0, spacingHint());

  QButtonGroup *bGroup = new QButtonGroup(i18n("Headings"),layoutTab);
  QVBoxLayout *bvbox = new QVBoxLayout(bGroup,8,5);

  bvbox->addSpacing(fontMetrics().lineSpacing()-4);
  w_layout[0] = new QRadioButton(i18n("O&ne heading for each database"),bGroup);
  w_layout[0]->setChecked(global->headLayout == 0);
  bvbox->addWidget(w_layout[0],1);
  w_layout[1] = new QRadioButton(i18n("A&s above, with separators between the definitions"),bGroup);
  w_layout[1]->setChecked(global->headLayout == 1);
  bvbox->addWidget(w_layout[1],1);
  w_layout[2] = new QRadioButton(i18n("A separate heading for &each definition"),bGroup);
  w_layout[2]->setChecked(global->headLayout == 2);
  bvbox->addWidget(w_layout[2],1);
  connect(w_layout[0], SIGNAL(toggled(bool)), SLOT(slotChanged()));
  connect(w_layout[1], SIGNAL(toggled(bool)), SLOT(slotChanged()));
  connect(w_layout[2], SIGNAL(toggled(bool)), SLOT(slotChanged()));

  vbox->addWidget(bGroup,0);
  vbox->addStretch(1);

  //************ Other ***************************
  otherTab = addPage(i18n("Miscellaneous"),i18n("Various Settings"), BarIcon("misc", KIcon::SizeMedium ));

  vbox = new QVBoxLayout(otherTab, 0, spacingHint());

  QGroupBox *group = new QGroupBox(i18n("Limits"),otherTab);

  grid = new QGridLayout(group,4,2,8,5);
  grid->addRowSpacing(0, fontMetrics().lineSpacing()-4);

  w_MaxDefinitions = new KIntSpinBox(100,10000,100,100,10,group);
  w_MaxDefinitions->setValue(global->maxDefinitions);
  l = new QLabel(w_MaxDefinitions, i18n("De&finitions:"), group);
  grid->addWidget(l,1,0);
  grid->addWidget(w_MaxDefinitions,1,1);
  connect(w_MaxDefinitions, SIGNAL(valueChanged(int)), SLOT(slotChanged()));

  w_Maxbrowse = new KIntSpinBox(1,100,1,1,10,group);
  w_Maxbrowse->setValue(global->maxBrowseListEntrys);
  l = new QLabel(w_Maxbrowse, i18n("Cached &results:"), group);
  grid->addWidget(l,2,0);
  grid->addWidget(w_Maxbrowse,2,1);
  connect(w_Maxbrowse, SIGNAL(valueChanged(int)), SLOT(slotChanged()));

  w_Maxhist = new KIntSpinBox(10,5000,10,10,10,group);
  w_Maxhist->setValue(global->maxHistEntrys);
  l = new QLabel(w_Maxhist, i18n("Hi&story entries:"), group);
  grid->addWidget(l,3,0);
  grid->addWidget(w_Maxhist,3,1);
  connect(w_Maxhist, SIGNAL(valueChanged(int)), SLOT(slotChanged()));

  grid->setColStretch(1,1);

  vbox->addWidget(group,0);

  group = new QGroupBox(i18n("Other"),otherTab);

  QVBoxLayout *vbox2 = new QVBoxLayout(group, 8, 5);

  vbox2->addSpacing(fontMetrics().lineSpacing()-4);

  w_Savehist = new QCheckBox(i18n("Sa&ve history on exit"),group);
  w_Savehist->setChecked(global->saveHistory);
  vbox2->addWidget(w_Savehist,0);
  connect(w_Savehist, SIGNAL(toggled(bool)), SLOT(slotChanged()));

  w_Clipboard = new QCheckBox(i18n("D&efine selected text on start"),group);
  w_Clipboard->setChecked(global->defineClipboard);
  vbox2->addWidget(w_Clipboard,1);
  connect(w_Clipboard, SIGNAL(toggled(bool)), SLOT(slotChanged()));

  vbox->addWidget(group,0);
  vbox->addStretch(2);

  setHelp("preferences");

  if (global->optSize.isValid())
    resize(global->optSize);
  else
    resize(300,200);
  enableButton( Apply, false );
  configChanged = false;
}
Пример #28
0
ExampleWidget::ExampleWidget( QWidget *parent, const char *name )
    : QWidget( parent, name )
{
    // Make the top-level layout; a vertical box to contain all widgets
    // and sub-layouts.
    QBoxLayout *topLayout = new QVBoxLayout( this, 5 );

    // Create a menubar...
    QMenuBar *menubar = new QMenuBar( this );
    menubar->setSeparator( QMenuBar::InWindowsStyle );
    QPopupMenu* popup;
    popup = new QPopupMenu( this );
    popup->insertItem( "&Quit", qApp, SLOT(quit()) );
    menubar->insertItem( "&File", popup );

    // ...and tell the layout about it.
    topLayout->setMenuBar( menubar );

    // Make an hbox that will hold a row of buttons.
    QBoxLayout *buttons = new QHBoxLayout( topLayout );
    int i;
    for ( i = 1; i <= 4; i++ ) {
	QPushButton* but = new QPushButton( this );
	QString s;
	s.sprintf( "Button %d", i );
	but->setText( s );

	// Set horizontal stretch factor to 10 to let the buttons
	// stretch horizontally. The buttons will not stretch
	// vertically, since bigWidget below will take up vertical
	// stretch.
	buttons->addWidget( but, 10 );
	// (Actually, the result would have been the same with a
	// stretch factor of 0; if no items in a layout have non-zero
	// stretch, the space is divided equally between members.)
    }

    // Make another hbox that will hold a left-justified row of buttons.
    QBoxLayout *buttons2 = new QHBoxLayout( topLayout );

    QPushButton* but = new QPushButton( "Button five", this );
    buttons2->addWidget( but );

    but = new QPushButton( "Button 6", this );
    buttons2->addWidget( but );

    // Fill up the rest of the hbox with stretchable space, so that
    // the buttons get their minimum width and are pushed to the left.
    buttons2->addStretch( 10 );

    // Make  a big widget that will grab all space in the middle.
    QMultiLineEdit *bigWidget = new QMultiLineEdit( this );
    bigWidget->setText( "This widget will get all the remaining space" );
    bigWidget->setFrameStyle( QFrame::Panel | QFrame::Plain );

    // Set vertical stretch factor to 10 to let the bigWidget stretch
    // vertically. It will stretch horizontally because there are no
    // widgets beside it to take up horizontal stretch.
    //    topLayout->addWidget( bigWidget, 10 );
    topLayout->addWidget( bigWidget ); 

    // Make a grid that will hold a vertical table of QLabel/QLineEdit
    // pairs next to a large QMultiLineEdit.

    // Don't use hard-coded row/column numbers in QGridLayout, you'll
    // regret it when you have to change the layout.
    const int numRows = 3;
    const int labelCol = 0;
    const int linedCol = 1;
    const int multiCol = 2;

    // Let the grid-layout have a spacing of 10 pixels between
    // widgets, overriding the default from topLayout.
    QGridLayout *grid = new QGridLayout( topLayout, 0, 0, 10 );
    int row;

    for ( row = 0; row < numRows; row++ ) {
	QLineEdit *ed = new QLineEdit( this );
	// The line edit goes in the second column
	grid->addWidget( ed, row, linedCol );	

	// Make a label that is a buddy of the line edit
	QString s;
	s.sprintf( "Line &%d", row+1 );
	QLabel *label = new QLabel( ed, s, this );
	// The label goes in the first column.
	grid->addWidget( label, row, labelCol );
    }

    // The multiline edit will cover the entire vertical range of the
    // grid (rows 0 to numRows) and stay in column 2.

    QMultiLineEdit *med = new QMultiLineEdit( this );
    grid->addMultiCellWidget( med, 0, -1, multiCol, multiCol );

    // The labels will take the space they need. Let the remaining
    // horizontal space be shared so that the multiline edit gets
    // twice as much as the line edit.
    grid->setColStretch( linedCol, 10 );
    grid->setColStretch( multiCol, 20 );

    // Add a widget at the bottom.
    QLabel* sb = new QLabel( this );
    sb->setText( "Let's pretend this is a status bar" );
    sb->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    // This widget will use all horizontal space, and have a fixed height.

    // we should have made a subclass and implemented sizePolicy there...
    sb->setFixedHeight( sb->sizeHint().height() );

    sb->setAlignment( AlignVCenter | AlignLeft );
    topLayout->addWidget( sb );

    topLayout->activate();
}