cMsgList::cMsgList(cServerDC *server): cConfMySQL(server->mMySQL), mCache(server->mMySQL,"pi_messages", "receiver", "date_sent"), mServer(server) { AddFields(); }
void MatchConfigDialog::on_SourcePlugin__activated (int idx) { Ui_.FieldName_->clear (); const auto pObj = Ui_.SourcePlugin_->itemData (idx).value<QObject*> (); AddFields (FieldsMap_ [pObj]); if (Ui_.FieldName_->count ()) on_FieldName__activated (0); }
// read settings from spool folder attribute and merge them to current settings void PrinterDriver::_MergeWithPreviousSettings(const char* attrName, BMessage* settings) { if (settings == NULL) return; BMessage stored; if (_ReadSettings(attrName, &stored)) { AddFields(&stored, settings); *settings = stored; } }
// -------------------------------------------------- void JobSetupWindow::UpdateJobMessage() { int32 copies = 1; int32 from; int32 to; if (fAll->Value() == B_CONTROL_ON) { from = 1; to = MAX_INT32; } else { from = atoi(fFrom->Text()); to = atoi(fTo->Text()); if (from <= 0) from = 1; if (to < from) to = from; } fSetupMsg->ReplaceInt32("copies", copies); fSetupMsg->ReplaceInt32("first_page", from); fSetupMsg->ReplaceInt32("last_page", to); AddFields(fSetupMsg, &fDocInfo); }
//***************************************************************************** const LOElementBase* SE2::getIGENModel(LOParentBase *IGENParent) { AddFields(IGENParent); return 0; }
cIPLog::cIPLog(cServerDC *server): cConfMySQL(server->mMySQL), mS(server) { AddFields(); }
// -------------------------------------------------- JobSetupWindow::JobSetupWindow(BMessage *msg, const char * printerName) : HWindow(BRect(0, 0, 100, 100), "Job setup", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE) { fSetupMsg = msg; fExitSem = create_sem(0, "JobSetup"); fResult = B_ERROR; if (printerName) { BString title; title << printerName << " job setup"; SetTitle(title.String()); fPrinterName = printerName; } // PrinterDriver ensures that property exists int32 firstPage; fSetupMsg->FindInt32("first_page", &firstPage); int32 lastPage; fSetupMsg->FindInt32("last_page", &lastPage); BMessage doc_info; if (fSetupMsg->FindMessage("doc_info", &doc_info) != B_OK) { // default fields doc_info.AddString("Author", ""); doc_info.AddString("Subject", ""); doc_info.AddString("Keywords", ""); fSetupMsg->AddMessage("doc_info", &doc_info); } AddFields(&fDocInfo, fSetupMsg, NULL, includeKeys); bool allPages = firstPage == 1 && lastPage == MAX_INT32; fAll = new BRadioButton("allPages", "Print all pages", new BMessage(ALL_PAGES_MGS)); fAll->SetValue(allPages); fRange = new BRadioButton("pagesRange", "Print pages:", new BMessage(RANGE_SELECTION_MSG)); fRange->SetValue(!allPages); fFrom = new BTextControl("from", "From:", "SomeSpaceHere", NULL); fFrom->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT); fFrom->SetEnabled(!allPages); fTo = new BTextControl("to", "To:", "", NULL); fTo->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT); fTo->SetEnabled(!allPages); BString buffer; buffer << firstPage; fFrom->SetText(buffer.String()); buffer = ""; buffer << lastPage; fTo->SetText(buffer.String()); for (uint32 i = 0; i < '0'; i++) { fTo->TextView()->DisallowChar(i); fFrom->TextView()->DisallowChar(i); } for (uint32 i = '9' + 1; i < 255; i++) { fTo->TextView()->DisallowChar(i); fFrom->TextView()->DisallowChar(i); } BButton* documentInfo = new BButton("documentInfo", "Document" B_UTF8_ELLIPSIS, new BMessage(DOC_INFO_MSG)); BButton* cancel = new BButton("cancel", "Cancel", new BMessage(CANCEL_MSG)); BButton* ok = new BButton("ok", "OK", new BMessage(OK_MSG)); ok->MakeDefault(true); BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_SMALL_SPACING) .SetInsets(B_USE_DEFAULT_SPACING) .Add(fAll) .Add(fRange) .AddGrid(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING) .SetInsets(B_USE_SMALL_SPACING, 0, B_USE_SMALL_SPACING, 0) .Add(fFrom->CreateLabelLayoutItem(), 0, 0) .Add(fFrom->CreateTextViewLayoutItem(), 1, 0) .Add(fTo->CreateLabelLayoutItem(), 0, 1) .Add(fTo->CreateTextViewLayoutItem(), 1, 1) .End() .AddGlue() .Add(new BSeparatorView(B_HORIZONTAL, B_FANCY_BORDER)) .AddGroup(B_HORIZONTAL) .Add(documentInfo) .AddGlue() .Add(cancel) .Add(ok) .End(); }
cStats::cStats(cServerDC *server): cConfMySQL(server->mMySQL), mS(server) { AddFields(); }
// -------------------------------------------------- JobSetupWindow::JobSetupWindow(BMessage *msg, const char * printerName) : HWindow(BRect(0, 0, 320, 160), "Job Setup", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE) { fSetupMsg = msg; fExitSem = create_sem(0, "JobSetup"); fResult = B_ERROR; if (printerName) { BString title; title << printerName << " Job Setup"; SetTitle(title.String()); fPrinterName = printerName; } // ---- Ok, build a default job setup user interface BRect r; BBox *panel; BBox *line; BButton *ok; BButton *cancel; BStringView *sv; float x, y, w, h; float indent; int32 copies; int32 firstPage; int32 lastPage; bool allPages; char buffer[80]; // PrinterDriver ensures that property exists fSetupMsg->FindInt32("copies", &copies); fSetupMsg->FindInt32("first_page", &firstPage); fSetupMsg->FindInt32("last_page", &lastPage); BMessage doc_info; if (B_OK != fSetupMsg->FindMessage("doc_info", &doc_info)) { // default fields doc_info.AddString("Author", ""); doc_info.AddString("Subject", ""); doc_info.AddString("Keywords", ""); fSetupMsg->AddMessage("doc_info", &doc_info); } AddFields(&fDocInfo, fSetupMsg, NULL, includeKeys); allPages = firstPage == 1 && lastPage == MAX_INT32; r = Bounds(); // add a *dialog* background panel = new BBox(r, "top_panel", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER); const int kMargin = 6; //const char *kCopiesLabel = "Copies:"; const char *kCopiesLabelExtraSpace = "Copies:##"; const char *kPagesRangeLabel = "Pages:"; const char *kAllPagesLabel = "All"; const char *kPagesRangeSelectionLabel = ""; const char *kFromLabel = "From:"; const char *kFromLabelExtraSpace = "From:##"; const char *kToLabel = "To:"; const char *kToLabelExtraSpace = "To:##"; r = panel->Bounds(); x = r.left + kMargin; y = r.top + kMargin; // add a "copies" input field /* Simon: temporarily removed this code sprintf(buffer, "%d", (int)copies); fCopies = new BTextControl(BRect(x, y, x+100, y+20), "copies", kCopiesLabel, buffer, new BMessage(NB_COPIES_MSG)); fCopies->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT); fCopies->ResizeToPreferred(); fCopies->GetPreferredSize(&w, &h); panel->AddChild(fCopies); y += h + kMargin; // "new line" */ // add a "pages" label sv = new BStringView(BRect(x, y, x+100, y+20), "pages_range", kPagesRangeLabel); panel->AddChild(sv); sv->ResizeToPreferred(); sv->GetPreferredSize(&w, &h); // align "copies" textcontrol field on the "allPages" radiobutton bellow... indent = be_plain_font->StringWidth(kCopiesLabelExtraSpace); w += kMargin; if ( w > indent ) indent = w; // fCopies->SetDivider(indent); x += indent; // add a "all" radiobutton fAll = new BRadioButton(BRect(x, y, x+100, y+20), "all_pages", kAllPagesLabel, new BMessage(ALL_PAGES_MGS)); fAll->ResizeToPreferred(); fAll->GetPreferredSize(&w, &h); fAll->SetValue(allPages); panel->AddChild(fAll); y += h + kMargin; // "new line" // add a range selection raddiobutton fRange = new BRadioButton(BRect(x, y, x+100, y+20), "pages_range_selection", kPagesRangeSelectionLabel, new BMessage(RANGE_SELECTION_MSG)); fRange->ResizeToPreferred(); fRange->GetPreferredSize(&w, &h); fRange->SetValue(!allPages); panel->AddChild(fRange); x += w + kMargin; // add a "from" field if (allPages) { buffer[0] = 0; } else { sprintf(buffer, "%d", (int)firstPage); } fFrom = new BTextControl(BRect(x, y, x+100, y+20), "from_field", kFromLabel, buffer, new BMessage(RANGE_FROM_MSG)); fFrom->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT); fFrom->SetDivider(be_plain_font->StringWidth(kFromLabelExtraSpace)); fFrom->ResizeToPreferred(); fFrom->GetPreferredSize(&w, &h); panel->AddChild(fFrom); x += w + kMargin; // add a "to" field if (allPages) { buffer[0] = 0; } else { sprintf(buffer, "%d", (int)lastPage); } fTo = new BTextControl(BRect(x, y, x+100, y+20), "to_field", kToLabel, buffer, new BMessage(RANGE_TO_MSG)); fTo->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT); fTo->SetDivider(be_plain_font->StringWidth(kToLabelExtraSpace)); fTo->ResizeToPreferred(); fTo->GetPreferredSize(&w, &h); panel->AddChild(fTo); y += h + kMargin + kMargin; // "new line" x = r.left + kMargin; // add a separator line... line = new BBox(BRect(r.left, y - 1, r.right, y), NULL, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP ); panel->AddChild(line); y += 2 + kMargin + kMargin; // "new line" // add a "OK" button, and make it default ok = new BButton(BRect(x, y, x+100, y+20), NULL, "OK", new BMessage(OK_MSG), B_FOLLOW_RIGHT | B_FOLLOW_TOP); ok->MakeDefault(true); ok->ResizeToPreferred(); ok->GetPreferredSize(&w, &h); x = r.right - w - kMargin; ok->MoveTo(x, ok->Frame().top); // put the ok bottom at bottom right corner panel->AddChild(ok); // add a "Cancel" button cancel = new BButton(BRect(x, y, x + 100, y + 20), NULL, "Cancel", new BMessage(CANCEL_MSG), B_FOLLOW_RIGHT | B_FOLLOW_TOP); cancel->ResizeToPreferred(); cancel->GetPreferredSize(&w, &h); cancel->MoveTo(x - w - kMargin, y); // put cancel button left next the ok button panel->AddChild(cancel); // add a "DocInfo" button BButton *button = new BButton(r, NULL, "Doc Info", new BMessage(DOC_INFO_MSG), B_FOLLOW_RIGHT | B_FOLLOW_TOP); button->GetPreferredSize(&w, &h); button->ResizeToPreferred(); button->MoveTo(8, y); panel->AddChild(button); // Finally, add our panel to window AddChild(panel); // Auto resize window ResizeTo(ok->Frame().right + kMargin, ok->Frame().bottom + kMargin); }