void Inquiry::slotTabChange() { InquiryWindow* window = (InquiryWindow*)_tabs->currentPage(); if (window == _account && _account->needsRefresh) slotAccountChange(); if (window == _card && _card->needsRefresh) slotCardChange(); if (window == _item && _item->needsRefresh) slotItemChange(); }
//-------------------------------------------------------------------------------- RepeatRangeWindow::RepeatRangeWindow( QWidget* parent, const char* name ) : QVBox( parent, name ? name : "RepeatRangeWindow" ) { setSpacing( 6 ); _group = new QVButtonGroup( i18n("Times to Match"), this, "groupbox" ); // Any number of times QRadioButton* radioBut = new QRadioButton(i18n("Any number of times (including zero times)"), _group, "RepeatRangeWindow::choice any times"); _group->insert(radioBut, ANY); QWidget* container = new QWidget( _group ); QHBoxLayout* lay = new QHBoxLayout( container ); QGrid* grid = new QGrid( 3, container ); grid->setSpacing( 5 ); lay->addWidget( grid ); lay->addStretch( 1 ); createLine( grid, i18n( "At least" ), &_leastTimes, ATLEAST ); createLine( grid, i18n( "At most" ), &_mostTimes, ATMOST ); createLine( grid, i18n( "Exactly" ), &_exactlyTimes, EXACTLY ); // from ___ to ___ times radioBut = new QRadioButton(i18n( "From" ), grid, "RepeatRangeWindow::from"); _group->insert( radioBut, MINMAX ); _rangeFrom = new QSpinBox( 1, 999, 1, grid); QHBox* box = new QHBox( grid ); box->setSpacing( 5 ); (void) new QLabel(i18n( "to" ), box); _rangeTo = new QSpinBox( 1, 999, 1, box ); (void) new QLabel( i18n( "time(s)" ), box ); connect( _rangeFrom, SIGNAL( valueChanged( int ) ), this, SLOT( slotUpdateMaxVal( int ) ) ); connect( _rangeTo, SIGNAL( valueChanged( int ) ), this, SLOT( slotUpdateMinVal( int ) ) ); // set a default button. _group->setButton(ANY); slotItemChange( ANY ); connect( _group, SIGNAL( clicked( int ) ), this, SLOT( slotItemChange( int ) ) ); }
Inquiry::Inquiry(MainWindow* main) : QuasarWindow(main, "Inquiry"), _loading(false) { _helpSource = "inquiry.html"; QFrame* frame = new QFrame(this); QLabel* dateLabel = new QLabel(tr("Dates:"), frame); _dateRange = new DateRange(frame); dateLabel->setBuddy(_dateRange); QLabel* fromLabel = new QLabel(tr("From:"), frame); _from = new DatePopup(frame); fromLabel->setBuddy(_from); QLabel* toLabel = new QLabel(tr("To:"), frame); _to = new DatePopup(frame); toLabel->setBuddy(_to); QLabel* storeLabel = new QLabel(tr("&Store:"), frame); _store = new LookupEdit(new StoreLookup(_main, this), frame); _store->setLength(30); storeLabel->setBuddy(_store); connect(_store, SIGNAL(validData()), SLOT(slotStoreChange())); _tabs = new QTabWidget(frame); _account = new AccountInquiry(main, _tabs); _card = new CardInquiry(main, _tabs); _item = new ItemInquiry(main, _tabs); _tabs->addTab(_account, tr("&Account")); _tabs->addTab(_card, tr("Car&d")); _tabs->addTab(_item, tr("&Item")); QFrame* box = new QFrame(frame); QPushButton* refresh = new QPushButton(tr("&Refresh"), box); refresh->setMinimumSize(refresh->sizeHint()); connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh())); QPushButton* print = new QPushButton(tr("&Print"), box); print->setMinimumSize(refresh->sizeHint()); connect(print, SIGNAL(clicked()), SLOT(slotPrint())); QPushButton* close = new QPushButton(tr("Cl&ose"), box); close->setMinimumSize(refresh->sizeHint()); connect(close, SIGNAL(clicked()), SLOT(close())); QGridLayout* boxGrid = new QGridLayout(box); boxGrid->setSpacing(6); boxGrid->setMargin(6); boxGrid->setColStretch(2, 1); boxGrid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter); boxGrid->addWidget(print, 0, 1, AlignLeft | AlignVCenter); boxGrid->addWidget(close, 0, 2, AlignRight | AlignVCenter); QGridLayout* grid = new QGridLayout(frame); grid->setSpacing(6); grid->setMargin(6); grid->setRowStretch(2, 1); grid->setColStretch(6, 1); grid->addWidget(dateLabel, 0, 0); grid->addWidget(_dateRange, 0, 1); grid->addWidget(fromLabel, 0, 2); grid->addWidget(_from, 0, 3, AlignLeft | AlignVCenter); grid->addWidget(toLabel, 0, 4); grid->addWidget(_to, 0, 5, AlignLeft | AlignVCenter); grid->addWidget(storeLabel, 1, 0); grid->addMultiCellWidget(_store, 1, 1, 1, 5, AlignLeft | AlignVCenter); grid->addMultiCellWidget(_tabs, 2, 2, 0, 6); grid->addMultiCellWidget(box, 3, 3, 0, 6); connect(_tabs, SIGNAL(selected(const QString&)), SLOT(slotTabChange())); connect(_account->search, SIGNAL(validData()), SLOT(slotAccountChange())); connect(_account->list, SIGNAL(doubleClicked(QListViewItem*)), SLOT(slotEdit())); connect(_account->list, SIGNAL(returnPressed(QListViewItem*)), SLOT(slotEdit())); connect(_card->search, SIGNAL(validData()), SLOT(slotCardChange())); connect(_card->list, SIGNAL(doubleClicked(QListViewItem*)), SLOT(slotEdit())); connect(_card->list, SIGNAL(returnPressed(QListViewItem*)), SLOT(slotEdit())); connect(_item->search, SIGNAL(validData()), SLOT(slotItemChange())); connect(_item->list, SIGNAL(doubleClicked(QListViewItem*)), SLOT(slotEdit())); connect(_item->list, SIGNAL(returnPressed(QListViewItem*)), SLOT(slotEdit())); _dateRange->setFromPopup(_from); _dateRange->setToPopup(_to); _dateRange->setCurrentItem(DateRange::Today); _dateRange->setFocus(); _store->setId(_quasar->defaultStore()); if (_quasar->storeCount() == 1) { storeLabel->hide(); _store->hide(); } setCaption(tr("Inquiry")); setCentralWidget(frame); finalize(); }