Module: Yast::MailUiInclude
- Defined in:
- ../../src/include/mail/ui.rb
Instance Method Summary (collapse)
-
- (Object) AliasesDialog
D1.1.
-
- (Object) AliasPopup(defaultv, existing)
D1.1.1, 1.2.1 Used for adding and editing an alias/virtual domain entry.
-
- (Object) check_mail_address(address)
See RFC 2822, 3.4 But for now, no-spaces@valid_domainname.
-
- (Object) check_username(username)
(taken from y2c_users ui.ycp).
-
- (Object) ConfirmDialog
Confirmation dialog before saving and installing needed packages.
-
- (Object) ConnectionTypeDialog
D1.
-
- (Object) DownloadingDialog
D3.
-
- (Object) FetchmailPopup(defaultv, existing)
D3.1.
-
- (Object) IncomingDialog
D2.
- - (Object) initialize_mail_ui(include_target)
-
- (Object) JustNext
A Wizard Sequencer helper.
-
- (Object) MailAutoSequence
Whole configuration of mail but without reading and writing.
-
- (Object) MailSequence
Whole configuration of mail.
-
- (Object) MasqueradeUserPopup(defaultv, existing)
D2.1.1 Used for adding and editing a user masquerading entry.
-
- (Object) MtaSelectionDialog
MTA selection dialog (only for autoinstallation, otherwise probed in Mail::Read).
-
- (Object) OutgoingAuthOptions
D2.2 Outgoing server authentification.
-
- (Object) OutgoingDetailsDialog
D2.1.
-
- (Object) OutgoingDialog
D2.
-
- (Object) ReadDialog
Read settings dialog.
-
- (Object) valid_username
(taken from y2c_users ui.ycp).
-
- (Object) VirtualDialog
D1.2.
-
- (Object) WriteDialog
Write settings dialog.
Instance Method Details
- (Object) AliasesDialog
D1.1
1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 |
# File '../../src/include/mail/ui.rb', line 1293 def AliasesDialog Wizard.SetScreenShotName("mail-2ib-aliases") aliases = MailAliases.MergeRootAlias(MailAliases.aliases) # Translators: dialog caption caption = _("Aliases") contents = VBox( VSpacing(0.2), Table( Id(:tab), Opt(:notify, :immediate), # Translators: table column headings Header( _("Alias"), # Translators: table column headings _("Destinations") ), makeItems(aliases, ["alias", "destinations"]) ), Left( HBox( PushButton(Id(:add), Opt(:key_F3), _("A&dd")), PushButton(Id(:edit), Opt(:key_F4), _("&Edit")), PushButton(Id(:delete), Opt(:key_F5), _("De&lete")) ) ), VSpacing(0.2) ) Wizard.SetContentsButtons( caption, contents, AliasesDialogHelp(), Label.BackButton, Label.OKButton ) ret = nil @edit_touched = false while true any_items = UI.QueryWidget(Id(:tab), :CurrentItem) != nil UI.ChangeWidget(Id(:edit), :Enabled, any_items) UI.ChangeWidget(Id(:delete), :Enabled, any_items) # Kludge, because a `Table still does not have a shortcut. UI.SetFocus(Id(:tab)) ret = UI.UserInput ret_sym = nil ret_sym = Convert.to_symbol(ret) if Ops.is_symbol?(ret) ret = :abort if ret == :cancel if Builtins.contains([:add, :edit, :delete], ret_sym) aliases = EditTable( Convert.to_symbol(ret), aliases, ["alias", "destinations"], fun_ref(method(:AliasPopup), "map (map, list <map>)"), :tab ) elsif ret == "man_aliases" Builtins.y2milestone("TODO: man aliases") elsif ret == :abort && Popup.ReallyAbort(Mail.touched || @edit_touched) || ret == :next || ret == :back break end end if ret == :next Mail.Touch(@edit_touched) MailAliases.aliases = deep_copy(aliases) MailAliases.FilterRootAlias end Wizard.RestoreScreenShotName Convert.to_symbol(ret) end |
- (Object) AliasPopup(defaultv, existing)
D1.1.1, 1.2.1 Used for adding and editing an alias/virtual domain entry.
1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 |
# File '../../src/include/mail/ui.rb', line 1218 def AliasPopup(defaultv, existing) defaultv = deep_copy(defaultv) existing = deep_copy(existing) _alias = Ops.get_string(defaultv, "alias", "") destinations = Ops.get_string(defaultv, "destinations", "") forbidden = Builtins.maplist(existing) do |e| Ops.get_string(e, "alias", "") end contents = HBox( HSpacing(1), VBox( VSpacing(0.2), # Translators: popup dialog heading Heading(_("Incoming mail redirection")), # Translators: text entry label Left(TextEntry(Id(:alias), _("&Alias"), _alias)), # Translators: text entry label Left(TextEntry(Id(:destinations), _("&Destinations"), destinations)), VSpacing(0.2), ButtonBox( PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton), PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton) ), VSpacing(0.2) ), HSpacing(1) ) UI.OpenDialog(Opt(:decorated), contents) UI.SetFocus(Id(:alias)) ret = nil while true ret = UI.UserInput if ret == :cancel break elsif ret == :ok # Input validation _alias = Convert.to_string(UI.QueryWidget(Id(:alias), :Value)) destinations = Convert.to_string( UI.QueryWidget(Id(:destinations), :Value) ) # TODO: this only works because check_mail_local part is too # permissive. Virtusertable aliases may contain @ so it is not # a local part and the check will need to be improved. # (But a postfix-style virtual domain will have an @-less entry.) if !check_mail_local_part(_alias) UI.SetFocus(Id(:alias)) # Translators: error message Popup.Message(_("The alias format is incorrect.")) elsif Builtins.contains(forbidden, _alias) UI.SetFocus(Id(:alias)) # Translators: error message Popup.Message( _("The destinations for this alias are already defined.") ) else # all checks OK, break the input loop break end end end UI.CloseDialog ret == :ok ? { "comment" => "", "alias" => _alias, "destinations" => destinations } : {} end |
- (Object) check_mail_address(address)
See RFC 2822, 3.4 But for now, no-spaces@valid_domainname
682 683 684 685 686 687 688 |
# File '../../src/include/mail/ui.rb', line 682 def check_mail_address(address) parts = Builtins.splitstring(address, "@") return false if Builtins.size(parts) != 2 check_mail_local_part(Ops.get(parts, 0, "")) && Hostname.CheckDomain(Ops.get(parts, 1, "")) end |
- (Object) check_username(username)
(taken from y2c_users ui.ycp)
651 652 653 654 655 656 657 658 659 660 661 |
# File '../../src/include/mail/ui.rb', line 651 def check_username(username) #DUH, auth_dialogs.ycp, users.ycp and Users.ycp have conflicing definitions! valid_logname_chars = "0123456789abcdefghijklmnopqrstuvwxyz-_" firstchar = Builtins.substring(username, 0, 1) username != "" && (Ops.greater_or_equal(firstchar, "a") && Ops.less_or_equal(firstchar, "z") || firstchar == "_") && Builtins.findfirstnotof(username, valid_logname_chars) == nil end |
- (Object) ConfirmDialog
Confirmation dialog before saving and installing needed packages
152 153 154 155 156 157 158 159 160 161 |
# File '../../src/include/mail/ui.rb', line 152 def ConfirmDialog # not to be displayed, #37554. # but ProbePackages still has to be called. # continue-cancel popup = _("The configuration will be written now.\n") = Mail.ProbePackages # return Popup::ContinueCancel (message1 + message2) ? `next : `back; :next end |
- (Object) ConnectionTypeDialog
D1
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File '../../src/include/mail/ui.rb', line 269 def ConnectionTypeDialog Wizard.SetScreenShotName("mail-1-conntype") = [] ct = Mail.connection_type ama = Mail.use_amavis ct = @preselect_connection_type if @preselect_connection_type != nil # Translators: dialog caption caption = _("General Settings") contents = Frame( # Translators: frame label _("Connection type"), RadioButtonVBox( :ctg, [ # Translators: radio button label RadioButton( Id(:permanent), Opt(:notify), _("&Permanent"), ct == :permanent ), # Translators: radio button label RadioButton(Id(:dialup), Opt(:notify), _("&Dial-up"), ct == :dialup), # Translators: radio button label RadioButton( Id(:none), Opt(:notify), _("No &connection"), ct == :none ), # Translators: radio button label RadioButton( Id(:nodaemon), Opt(:notify), _("Do not start Postfix as Daemon"), ct == :nodaemon ) ] ) ) amavis_t = Left(WJ_MakeWidget(:use_amavis)) = Builtins.add(, :use_amavis) dkim_t = Left(WJ_MakeWidget(:use_dkim)) = Builtins.add(, :use_dkim) contents = HSquash(VBox(contents, VSpacing(1), amavis_t, dkim_t)) Wizard.SetContentsButtons( caption, contents, WJ_MakeHelp(Builtins.prepend(, ConnectionTypeDialogHelp())), Label.BackButton, Label.NextButton ) ret = nil while true ct = Convert.to_symbol(UI.QueryWidget(Id(:ctg), :CurrentButton)) if ct == :permanent || ct == :dialup UI.ChangeWidget(Id(:use_amavis), :Enabled, true) UI.ChangeWidget(Id(:use_dkim), :Enabled, true) Wizard.RestoreNextButton elsif ct == :nodaemon UI.ChangeWidget(Id(:use_amavis), :Value, false) UI.ChangeWidget(Id(:use_amavis), :Enabled, false) UI.ChangeWidget(Id(:use_dkim), :Value, false) UI.ChangeWidget(Id(:use_dkim), :Enabled, false) elsif ct == :none UI.ChangeWidget(Id(:use_amavis), :Value, false) UI.ChangeWidget(Id(:use_amavis), :Enabled, false) UI.ChangeWidget(Id(:use_dkim), :Value, false) UI.ChangeWidget(Id(:use_dkim), :Enabled, false) Wizard.SetNextButton(:next, Label.FinishButton) end ama = Convert.to_boolean(UI.QueryWidget(Id(:use_amavis), :Value)) if ama UI.ChangeWidget(Id(:use_dkim), :Enabled, true) else UI.ChangeWidget(Id(:use_dkim), :Value, false) UI.ChangeWidget(Id(:use_dkim), :Enabled, false) end ret = UI.UserInput ret = :abort if ret == :cancel if ret == :back || ret == :abort && Popup.ReallyAbort(Mail.touched) break elsif ret == :next break if WJ_Validate() end end if ret == :next WJ_Set() ct = Convert.to_symbol(UI.QueryWidget(Id(:ctg), :CurrentButton)) Mail.Touch(Mail.connection_type != ct) Mail.connection_type = ct ret = ct == :none ? :none : ret end # avoid overriding the choice the user has made @preselect_connection_type = nil Wizard.RestoreScreenShotName Convert.to_symbol(ret) end |
- (Object) DownloadingDialog
D3
1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 |
# File '../../src/include/mail/ui.rb', line 1113 def DownloadingDialog Wizard.SetScreenShotName("mail-2ia-download") #List of maps: $[server:, protocol:, remote_user:, local_user:, password:] fm = deep_copy(Mail.fetchmail) # Translators: dialog caption caption = _("Mail downloading") contents = VBox( VSpacing(0.2), # * no time to implement this :-( # * #22903 # `Frame ( # // Translators: frame label # // When should Fetchmail run # // Fetchmail is a program name, do not translate # _("Run Fetchmail"), # RadioButtonVBox ( # `run_fm_g, # [ # // Translators: radio button label # `RadioButton (`id (`run_fm_man), _("&Manually"), true), // TODO fake # // Translators: radio button label # `RadioButton (`id (`run_fm_ppp), _("For &dial-up network connections"), false), # // Translators: radio button label # `RadioButton (`id (`run_fm_net), _("For &all network connections"), false), # ] # ) # ), # `VSpacing (0.5), Table( Id(:tab), Opt(:notify, :immediate), # Translators: table column headings Header( _("Server"), # Translators: table column headings _("Protocol"), # Translators: table column headings _("User"), # Translators: table column headings _("Local user") ), makeItems(fm, ["server", "protocol", "remote_user", "local_user"]) ), HBox( PushButton(Id(:add), Opt(:key_F3), _("A&dd")), PushButton(Id(:edit), Opt(:key_F4), _("&Edit")), PushButton(Id(:delete), Opt(:key_F5), _("De&lete")) ), VSpacing(0.2) ) Wizard.SetContentsButtons( caption, contents, DownloadingDialogHelp(), Label.BackButton, Label.OKButton ) UI.ChangeWidget(Id(:edit), :Enabled, false) UI.ChangeWidget(Id(:delete), :Enabled, false) ret = nil @edit_touched = false while true any_items = UI.QueryWidget(Id(:tab), :CurrentItem) != nil UI.ChangeWidget(Id(:edit), :Enabled, any_items) UI.ChangeWidget(Id(:delete), :Enabled, any_items) # Kludge, because a `Table still does not have a shortcut. UI.SetFocus(Id(:tab)) ret = Convert.to_symbol(UI.UserInput) ret = :abort if ret == :cancel if Builtins.contains([:add, :edit, :delete], ret) fm = EditTable( ret, fm, ["server", "protocol", "remote_user", "local_user"], fun_ref(method(:FetchmailPopup), "map (map, list <map>)"), :tab ) elsif ret == :abort && Popup.ReallyAbort(Mail.touched || @edit_touched) || ret == :next || ret == :back break end end if ret == :next Mail.Touch(Mail.fetchmail != fm) Mail.fetchmail = deep_copy(fm) end Wizard.RestoreScreenShotName ret end |
- (Object) FetchmailPopup(defaultv, existing)
D3.1
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 |
# File '../../src/include/mail/ui.rb', line 1049 def FetchmailPopup(defaultv, existing) defaultv = deep_copy(defaultv) existing = deep_copy(existing) @fetchmail_item = deep_copy(defaultv) @fetchmail_item_touched = false = [ :fm_server, :fm_protocol, :fm_remote_user, :fm_password, :fm_local_user ] contents = HBox( HSpacing(1), VBox( VSpacing(0.2), # Translators: popup dialog heading Heading(_("Mail downloading")), Left(WJ_MakeWidget(:fm_server)), Left(WJ_MakeWidget(:fm_protocol)), Left(WJ_MakeWidget(:fm_remote_user)), Left(WJ_MakeWidget(:fm_password)), Left(WJ_MakeWidget(:fm_local_user)), VSpacing(0.2), ButtonBox( PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton), PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton) ), VSpacing(0.2) ), HSpacing(1) ) UI.OpenDialog(Opt(:decorated), contents) # set combo boxes to proper values WJ_GetWidget(:fm_protocol) WJ_GetWidget(:fm_local_user) UI.SetFocus(Id(:fm_server)) ret = nil while true ret = UI.UserInput if ret == :cancel break elsif ret == :ok # Input validation if WJ_Validate() # all checks OK, break the input loop break end end end WJ_Set() # TODO hope it is ok to mess it up UI.CloseDialog ret == :ok ? @fetchmail_item : {} end |
- (Object) IncomingDialog
D2
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 |
# File '../../src/include/mail/ui.rb', line 459 def IncomingDialog Wizard.SetScreenShotName("mail-22-incoming") = [] # watch out, fm_widgets are not part of widgets # because of special validation requirements = [:listen_remote] # firewall widget using CWM fw_settings = { "services" => ["service:smtp"], "display_details" => true } = CWMFirewallInterfaces.CreateOpenFirewallWidget( fw_settings ) # Translators: dialog caption caption = _("Incoming Mail") i_contents = VBox() i_contents = Builtins.add(i_contents, Left(WJ_MakeWidget(:listen_remote))) i_contents = Builtins.add( i_contents, Ops.get_term(, "custom_widget", Empty()) ) = [] if true # always embed the first account # Edit the first fetchmail item here. # Copy it into the edit buffer. @fetchmail_item = Ops.get(Mail.fetchmail, 0, {}) = [ :fm_server, :fm_protocol, :fm_remote_user, :fm_password, :fm_local_user ] fm_contents = VBox( HSpacing(40), # prevent fm_password being squashed in curses HBox( WJ_MakeWidget(:fm_server), HSpacing(1), WJ_MakeWidget(:fm_protocol) ), HBox( WJ_MakeWidget(:fm_remote_user), HSpacing(1), WJ_MakeWidget(:fm_password) ), HBox( Bottom(WJ_MakeWidget(:fm_local_user)), HSpacing(1), # pushbutton Bottom(PushButton(Id(:downloading), Opt(:key_F7), _("&Details..."))) ), HBox( Left( ComboBox( Id(:fm_start), _("Start &fetchmail"), ["manual", "daemon"] ) ) ) ) # frame label: mail downloading (fetchmail) fm_frame = Frame(_("&Downloading"), fm_contents) i_contents = Builtins.add( i_contents, HBox(HSpacing(1), fm_frame, HSpacing(1)) ) end i_contents = Builtins.add(i_contents, WJ_MakeWidget(:root_alias)) = Builtins.add(, :root_alias) if Mail.mta == :postfix i_contents = Builtins.add(i_contents, WJ_MakeWidget(:delivery_mode)) = Builtins.add(, :delivery_mode) end i_contents = Builtins.add( i_contents, # menu button: details of incoming mail HBox( PushButton(Id(:aliases), _("&Aliases...")), PushButton(Id(:virtual), _("&Virtual domains...")) ) ) = Builtins.flatten([, [:downloading, :aliases, :virtual]]) # frame label # term i_frame = `Frame (_("Incoming Mail"), i_contents); contents = HSquash(VBox(VStretch(), i_contents, VStretch())) help = "" #TODO Wizard.SetContentsButtons( caption, contents, Ops.add(WJ_MakeHelp(), Ops.get_string(, "help", "")), Label.BackButton, Label.FinishButton ) # set combo boxes to proper values WJ_GetWidget(:fm_protocol) WJ_GetWidget(:fm_local_user) WJ_GetWidget(:delivery_mode) # initialize the widget (set the current value) CWMFirewallInterfaces.OpenFirewallInit(, "") UI.ChangeWidget(Id(:fm_start), :Value, Mail.fetchmail_mode) # nothing entered in the dowloading items - don't save them fm_empty = true event = nil ret = nil while true event = UI.WaitForEvent ret = Ops.get(event, "ID") ret = :abort if ret == :cancel # handle the events, enable/disable the button, show the popup if button clicked CWMFirewallInterfaces.OpenFirewallHandle(, "", event) if ret == :back || ret == :abort && Popup.ReallyAbort(Mail.touched) break elsif ret == :next || Builtins.contains(, ret) Mail.fetchmail_mode = Convert.to_string( UI.QueryWidget(Id(:fm_start), :Value) ) # input validation # For consistency, all querywidgets are done here if WJ_Validate() fm_empty = UI.QueryWidget(Id(:fm_server), :Value) == "" && UI.QueryWidget(Id(:fm_remote_user), :Value) == "" && UI.QueryWidget(Id(:fm_password), :Value) == "" && UI.QueryWidget(Id(:fm_local_user), :Value) == "" if fm_empty || WJ_Validate() # all checks OK, break the input loop break end end end end if ret == :next || Builtins.contains(, ret) WJ_Set() # grab current settings, store them to SuSEFirewall:: CWMFirewallInterfaces.OpenFirewallStore(, "", event) if !fm_empty WJ_Set() # CHECK: aliasing is not harmful here Ops.set(Mail.fetchmail, 0, @fetchmail_item) # -------------- fix of bug #29919: # -------------- propose local domains when fetchmail is used: if Mail.fetchmail != [] && Mail.local_domains == [] && Mail.mta == :postfix ld = ["\\$myhostname", "localhost.\\$mydomain", "\\$mydomain"] # popup text # %1: variable name (eg. POSTFIX_LOCALDOMAINS) # %2: file name (eg. /etc/sysconfig/postfix) # %3: value (about 50 characters) if Popup.YesNo( Builtins.sformat( _( "To be able to deliver mail to your local MTA,\n" + "the value of %1 in %2 will be set to\n" + "\"%3\"." ), "POSTFIX_LOCALDOMAINS", "/etc/sysconfig/postfix", Builtins.mergestring(ld, ", ") ) ) Mail.local_domains = deep_copy(ld) end end end end Wizard.RestoreScreenShotName Convert.to_symbol(ret) end |
- (Object) initialize_mail_ui(include_target)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File '../../src/include/mail/ui.rb', line 21 def initialize_mail_ui(include_target) Yast.import "UI" textdomain "mail" Yast.import "Wizard" Yast.import "Progress" Yast.import "Mode" Yast.import "Mail" Yast.import "MailAliases" Yast.import "Hostname" Yast.import "CWMFirewallInterfaces" Yast.import "Popup" Yast.import "Label" Yast.import "Sequencer" Yast.import "Package" Yast.include include_target, "mail/helps.rb" Yast.include include_target, "mail/wj.rb" # A command line argument can override what is read from SCR. # Used when starting mail from lan/modem. @preselect_connection_type = nil @dialogs = { "read" => [lambda { ReadDialog() }, true], "confirm" => [lambda { ConfirmDialog() }, true], "write" => [lambda { WriteDialog() }, true], "mta" => lambda { MtaSelectionDialog() }, "connection_type" => lambda { ConnectionTypeDialog() }, "outgoing" => lambda { OutgoingDialog() }, "incoming" => lambda { IncomingDialog() }, "outgoing-details" => lambda { OutgoingDetailsDialog() }, "outgoing-auth" => lambda { OutgoingAuthOptions() }, "downloading" => lambda { DownloadingDialog() }, "aliases" => lambda { AliasesDialog() }, "virtual" => lambda { VirtualDialog() }, "common-next" => [lambda { JustNext() }, true] } @common_sequence = { #"ws_start" : must be defined in an overriding sequence "connection_type" => { :abort => :abort, :next => "outgoing", :none => "common-next" }, "outgoing" => { :abort => :abort, :outgoing_details => "outgoing-details", :outgoing_auth_opts => "outgoing-auth", :next => "incoming" }, "incoming" => { :abort => :abort, :downloading => "downloading", :aliases => "aliases", :virtual => "virtual", :next => "common-next" }, "outgoing-details" => { :abort => :abort, :next => "outgoing" }, "outgoing-auth" => { :abort => :abort, :next => "outgoing" }, "downloading" => { :abort => :abort, :next => "incoming" }, "aliases" => { :abort => :abort, :next => "incoming" }, "virtual" => { :abort => :abort, :next => "incoming" }, "common-next" => { :next => :next } } end |
- (Object) JustNext
A Wizard Sequencer helper
1455 1456 1457 |
# File '../../src/include/mail/ui.rb', line 1455 def JustNext :next end |
- (Object) MailAutoSequence
Whole configuration of mail but without reading and writing. MTA is selected first. For use with autoinstallation.
1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 |
# File '../../src/include/mail/ui.rb', line 1490 def MailAutoSequence sequence = # common_sequence here { "ws_start" => "mta", "mta" => { :abort => :abort, :next => "connection_type" } } # Translators: dialog caption caption = _("Mail configuration") # label contents = Label(_("Initializing...")) Wizard.CreateDialog Wizard.SetDesktopIcon("mail") Wizard.SetContentsButtons( caption, contents, "", Label.BackButton, Label.NextButton ) # the second map must override the first! sequence = Builtins.union(@common_sequence, sequence) ret = Sequencer.Run(@dialogs, sequence) UI.CloseDialog Convert.to_symbol(ret) end |
- (Object) MailSequence
Whole configuration of mail
1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 |
# File '../../src/include/mail/ui.rb', line 1461 def MailSequence sequence = { "ws_start" => "read", "read" => { :abort => :abort, :next => "connection_type" }, # common_sequence here # override "common-next" => { :next => "confirm" }, "confirm" => { :next => "write" }, "write" => { :abort => :abort, :next => :next } } Wizard.CreateDialog Wizard.SetDesktopTitleAndIcon("mail") # the second map must override the first! sequence = Builtins.union(@common_sequence, sequence) ret = Sequencer.Run(@dialogs, sequence) UI.CloseDialog Convert.to_symbol(ret) end |
- (Object) MasqueradeUserPopup(defaultv, existing)
D2.1.1 Used for adding and editing a user masquerading entry.
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 |
# File '../../src/include/mail/ui.rb', line 695 def MasqueradeUserPopup(defaultv, existing) defaultv = deep_copy(defaultv) existing = deep_copy(existing) user = Ops.get_string(defaultv, "user", "") address = Ops.get_string(defaultv, "address", "") forbidden = Builtins.maplist(existing) do |e| Ops.get_string(e, "user", "") end contents = HBox( HSpacing(1), VBox( VSpacing(0.2), # Translators: popup dialog heading Heading(_("Sender address rewriting")), Mode.config ? # Translators: text entry label Left(TextEntry(Id(:user), _("&Local user"), user)) : Left( ComboBox( Id(:user), Opt(:editable, :hstretch), _("&Local user"), GetLocalUsers() ) ), # Translators: text entry label Left(TextEntry(Id(:address), _("&Display as"), address)), VSpacing(0.2), ButtonBox( PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton), PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton) ), VSpacing(0.2) ), HSpacing(1) ) UI.OpenDialog(Opt(:decorated), contents) UI.ChangeWidget(Id(:user), :Value, user) UI.SetFocus(Id(:user)) ret = nil while true ret = UI.UserInput if ret == :cancel break elsif ret == :ok # Input validation user = Convert.to_string(UI.QueryWidget(Id(:user), :Value)) address = Convert.to_string(UI.QueryWidget(Id(:address), :Value)) if !check_username(user) UI.SetFocus(Id(:user)) Popup.Error(valid_username) elsif Builtins.contains(forbidden, user) UI.SetFocus(Id(:user)) # Translators: error message Popup.Error(_("The address for this user is already defined.")) elsif !check_mail_address(address) # string valid_mail_address # no-spaces@valid_domainname UI.SetFocus(Id(:address)) # error popup Popup.Error(_("The mail address format is incorrect.")) else # all checks OK, break the input loop break end end end UI.CloseDialog ret == :ok ? { "comment" => "", "user" => user, "address" => address } : {} end |
- (Object) MtaSelectionDialog
MTA selection dialog (only for autoinstallation, otherwise probed in Mail::Read)
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File '../../src/include/mail/ui.rb', line 195 def MtaSelectionDialog Wizard.SetScreenShotName("mail-0-mta") mta = Mail.mta # for now. TODO: disable Next if none selected mta = :postfix if mta != :sendmail && mta != :postfix # Translators: dialog caption # Mailer: Sendmail or Postfix caption = _("Mail transfer agent") contents = Frame( # Translators: frame label # Mailer: Sendmail or Postfix _("Mail transfer agent"), RadioButtonGroup( Id(:mtag), HSquash( VBox( HSpacing(23), # qt bug workaround, #23979 VSpacing(0.2), # MTA name does not need translation Left( RadioButton( Id(:sendmail), Opt(:autoShortcut), "Sendmail", mta == :sendmail ) ), # MTA name does not need translation Left( RadioButton( Id(:postfix), Opt(:autoShortcut), "Postfix", mta == :postfix ) ), VSpacing(0.2) ) ) ) ) Wizard.SetContentsButtons( caption, contents, MtaSelectionDialogHelp(), Label.BackButton, Label.NextButton ) ret = nil while true ret = UI.UserInput ret = :abort if ret == :cancel if ret == :back || ret == :next || ret == :abort && Popup.ReallyAbort(Mail.touched) break end end if ret == :next mta = Convert.to_symbol(UI.QueryWidget(Id(:mtag), :CurrentButton)) Mail.Touch(Mail.mta != mta) Mail.mta = mta end Wizard.RestoreScreenShotName Convert.to_symbol(ret) end |
- (Object) OutgoingAuthOptions
D2.2 Outgoing server authentification
944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 |
# File '../../src/include/mail/ui.rb', line 944 def OutgoingAuthOptions Wizard.SetScreenShotName("mail-2o-outgoing-authentication") #string mod = listToString (Mail::masquerade_other_domains); #list<string> lmod = []; #list<map> mu = Mail::masquerade_users; # Translators: dialog caption caption = _("Outgoing Server Authentication") contents = VBox( HBox( HWeight(1, Empty()), HWeight( 3, VBox( # text entry TextEntry(Id(:server), _("Outgoing &Server")), # text entry TextEntry(Id(:user), _("&User name")), # password entry Password(Id(:passw), _("&Password")) ) ), HWeight(1, Empty()) ) ) #); Wizard.SetContentsButtons( caption, contents, AuthenticationDialogHelp(), Label.BackButton, Label.OKButton ) ret = nil config = Ops.get(Mail.smtp_auth, 0, {}) if config == {} config = Builtins.add(config, "server", Mail.outgoing_mail_server) config = Builtins.add(config, "user", "") config = Builtins.add(config, "password", "") end UI.ChangeWidget(Id(:server), :Value, Ops.get_string(config, "server", "")) UI.ChangeWidget(Id(:user), :Value, Ops.get_string(config, "user", "")) UI.ChangeWidget( Id(:passw), :Value, Ops.get_string(config, "password", "") ) while true ret = UI.UserInput ret = :abort if ret == :cancel if ret == :abort && Popup.ReallyAbort(Mail.touched) || ret == :back break elsif ret == :next server = Convert.to_string(UI.QueryWidget(Id(:server), :Value)) user = Convert.to_string(UI.QueryWidget(Id(:user), :Value)) password = Convert.to_string(UI.QueryWidget(Id(:passw), :Value)) if server == "" && user == "" && password == "" # wants to delete it, ok config = {} break else Ops.set(config, "server", server) Ops.set(config, "user", user) Ops.set(config, "password", password) end # validity checks: reuse fetchmail widgets if Validate_outgoing_mail_server(:server) && Validate_fm_remote_user(:user) break end end end if ret == :next # all querywidgets are already done by the validation part Mail.Touch(Ops.get(Mail.smtp_auth, 0, {}) != config) Ops.set(Mail.smtp_auth, 0, config) # removing? had to add it first so that there is something to remove. if config == {} Mail.smtp_auth = Builtins.remove(Mail.smtp_auth, 0) else # #158220 Mail.Touch( Mail.outgoing_mail_server != Ops.get_string(config, "server", "") ) Mail.outgoing_mail_server = Ops.get_string(config, "server", "") end end Wizard.RestoreScreenShotName Convert.to_symbol(ret) end |
- (Object) OutgoingDetailsDialog
D2.1
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 |
# File '../../src/include/mail/ui.rb', line 777 def OutgoingDetailsDialog Wizard.SetScreenShotName("mail-2o-outgoing-details") mod = listToString(Mail.masquerade_other_domains) lmod = [] mu = deep_copy(Mail.masquerade_users) # Translators: dialog caption caption = _("Masquerading") contents = VBox( VSpacing(0.2), RadioButtonGroup( Id(:mdg), VBox( VSpacing(0.2), WJ_MakeWidget(:from_header), VSpacing(0.2), WJ_MakeWidget(:local_domains), VSpacing(0.2), Left( RadioButton( Id(:masqlocal), # Translators: radio button label _("Masquerade &local domains"), mod == "" ) ), # `HBox ( # `HSpacing (2), # `TextEntry (`id (`masqdomains), `opt (`disabled), _("That is"), ld) #// `Left (`Label (`opt (`outputField, `hstretch), ld)) # ), # Translators: radio button label Left( RadioButton( Id(:masqothers), _("Ma&squerade other domains"), mod != "" ) ), HBox( HSpacing(2), # Translators: text entry label TextEntry( Id(:masqdomains), Opt(:notify), _("Do&mains to masquerade"), mod ) ) ) ), VSpacing(1), Table( Id(:tab), Opt(:notify, :immediate), # Translators: table column headings Header( _("Local user"), # Translators: table column headings _("Display as") ), makeItems(mu, ["user", "address"]) ), # `HBox ( # `HWeight (1, `ComboBox (`id (`user), `opt (`editable), _("Local user"), # ["holly", "jane", "tarzan"])), # `HWeight (2, `TextEntry (`id (`address), _("Display as"), "holly@red.dwarf")) # ), HBox( PushButton(Id(:add), Opt(:key_F3), _("A&dd")), PushButton(Id(:edit), Opt(:key_F4), _("&Edit")), PushButton(Id(:delete), Opt(:key_F5), _("Dele&te")) ), VSpacing(1) ) help = Ops.add( WJ_MakeHelp([:from_header, :local_domains]), MasqueradingDialogHelp() ) Wizard.SetContentsButtons( caption, contents, help, Label.BackButton, Label.OKButton ) ret = nil @edit_touched = false while true any_items = UI.QueryWidget(Id(:tab), :CurrentItem) != nil UI.ChangeWidget(Id(:edit), :Enabled, any_items) UI.ChangeWidget(Id(:delete), :Enabled, any_items) # Kludge, because a `Table still does not have a shortcut. # watch out, a textentry sends UI too UI.SetFocus(Id(:tab)) if ret != :masqdomains ret = Convert.to_symbol(UI.UserInput) ret = :abort if ret == :cancel if ret == :masqdomains UI.ChangeWidget(Id(:mdg), :CurrentButton, :masqothers) elsif Builtins.contains([:add, :edit, :delete], ret) mu = EditTable( ret, mu, ["user", "address"], fun_ref(method(:MasqueradeUserPopup), "map (map, list <map>)"), :tab ) elsif ret == :abort && Popup.ReallyAbort(Mail.touched || @edit_touched) || ret == :back break elsif ret == :next # Input validation # For consistency, all querywidgets are done here. # The table contents is maintained and validated # at the EditTable call. rb = Convert.to_symbol(UI.QueryWidget(Id(:mdg), :CurrentButton)) if rb == :masqothers mod = Convert.to_string(UI.QueryWidget(Id(:masqdomains), :Value)) lmod = stringToList(mod) else lmod = [] end if !Validate_from_header(:from_header) Builtins.y2debug("nothing") elsif !Validate_local_domains(:local_domains) Builtins.y2debug("nothing, already done") elsif Builtins.find(lmod) { |s| !Hostname.CheckDomain(s) } != nil UI.SetFocus(Id(:masqdomains)) # Translators: error popup # Already in Translation Memory msg = _("The domain name is incorrect") # TODO: describe a valid domain name Popup.Error(msg) else # all checks OK, break the input loop break end end end if ret == :next # all querywidgets are already done by the validation part Set_from_header(:from_header) Set_local_domains(:local_domains) Mail.Touch(Mail.masquerade_other_domains != lmod) Mail.masquerade_other_domains = deep_copy(lmod) Mail.Touch(Mail.masquerade_users != mu) Mail.masquerade_users = deep_copy(mu) end Wizard.RestoreScreenShotName ret end |
- (Object) OutgoingDialog
D2
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
# File '../../src/include/mail/ui.rb', line 381 def OutgoingDialog Wizard.SetScreenShotName("mail-21-outgoing") _TLSnone = Mail.smtp_use_TLS == "no" _TLSuse = Mail.smtp_use_TLS == "yes" _TLSmust = Mail.smtp_use_TLS == "must" # what buttons can be used to leave this dialog #(except the std wizarding ones) = [] = [:outgoing_mail_server] # Translators: dialog caption caption = _("Outgoing Mail") o_contents = VSquash( VBox( WJ_MakeWidget(:outgoing_mail_server), # TLS Label(_("The server uses &TLS.")), RadioButtonGroup( Id(:TLS), HBox( Left(RadioButton(Id("no"), _("No"), _TLSnone)), Left(RadioButton(Id("yes"), _("Use"), _TLSuse)), Left(RadioButton(Id("must"), _("Enforce"), _TLSmust)) ) ), HBox( PushButton(Id(:outgoing_details), _("&Masquerading")), PushButton(Id(:outgoing_auth_opts), _("&Authentication")) ) ) ) = Builtins.add(, :outgoing_details) = Builtins.add(, :outgoing_auth_opts) # frame label o_frame = Frame(_("Outgoing Mail"), o_contents) contents = HSquash(VBox(VStretch(), o_frame, VStretch())) help = "" #TODO Wizard.SetContentsButtons( caption, contents, WJ_MakeHelp(), Label.BackButton, Label.NextButton ) ret = nil while true ret = Convert.to_symbol(UI.UserInput) ret = :abort if ret == :cancel if ret == :back || ret == :abort && Popup.ReallyAbort(Mail.touched) break elsif ret == :next || Builtins.contains(, ret) # input validation # For consistency, all querywidgets are done here if WJ_Validate() # all checks OK, break the input loop break end end end if ret == :next || Builtins.contains(, ret) Mail.smtp_use_TLS = Convert.to_string(UI.QueryWidget(Id(:TLS), :Value)) WJ_Set() end Wizard.RestoreScreenShotName ret end |
- (Object) ReadDialog
Read settings dialog
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File '../../src/include/mail/ui.rb', line 93 def ReadDialog Wizard.SetScreenShotName("mail-0-read") # Set help text Wizard.RestoreHelp(ReadDialogHelp()) # A callback function for abort callback = lambda { UI.PollInput == :abort } # Read the configuration was_ok = true if Mode.screen_shot Mail.Fake # make it possible to snap this dialog Builtins.sleep(3000) UI.PollInput else was_ok = Mail.Read(callback) end # TODO FIXME possibly handle the abort if was_ok if !Mail.CreateConfig setting = "MAIL_CREATE_CONFIG" # Translators: continue/cancel dialog # %1 is a sysconfig variable name was_ok = Popup.ContinueCancel( Builtins.sformat( _( "The setting %1 is turned off. You have\n" + "probably modified the configuration files directly.\n" + "If you continue, it will be turned on and\n" + "Config Postfix will overwrite manual changes.\n" ), setting ) ) end else if Mail.mta == :other # After text freeze, but # a) either something is very broken -> user must know # b) user installed a different MTA -> knowledgeable enough to # ba) never see this message anyway # bb) read English # TODO: look at exim and mention it in the popup # Translators: error popup Popup.Error( _( "YaST can only configure Postfix and Sendmail,\nbut neither of them is installed." ) ) end end Wizard.RestoreScreenShotName was_ok ? :next : :abort end |
- (Object) valid_username
(taken from y2c_users ui.ycp)
665 666 667 668 669 670 671 672 673 674 675 676 |
# File '../../src/include/mail/ui.rb', line 665 def valid_username # There is a check whether the information from the UI is # correct and complete. The login name may contain only # certain characters and must begin with a letter. # Already in Translation Memory _( "The user login may contain only\n" + "lower case letters, digits, \"-\" and \"_\"\n" + "and must begin with a letter or \"_\".\n" + "Please try again.\n" ) end |
- (Object) VirtualDialog
D1.2
1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 |
# File '../../src/include/mail/ui.rb', line 1376 def VirtualDialog Wizard.SetScreenShotName("mail-2ic-virtdomains") vu = deep_copy(Mail.virtual_users) # Translators: dialog caption caption = _("Virtual domains") contents = VBox( VSpacing(0.2), Table( Id(:tab), Opt(:notify, :immediate), # Translators: table column headings Header( _("Alias"), # Translators: table column headings _("Destinations") ), makeItems(vu, ["alias", "destinations"]) ), Left( HBox( PushButton(Id(:add), Opt(:key_F3), _("A&dd")), PushButton(Id(:edit), Opt(:key_F4), _("&Edit")), PushButton(Id(:delete), Opt(:key_F5), _("De&lete")) ) ), VSpacing(0.2) ) Wizard.SetContentsButtons( caption, contents, VirtualDialogHelp(), Label.BackButton, Label.OKButton ) UI.ChangeWidget(Id(:edit), :Enabled, false) UI.ChangeWidget(Id(:delete), :Enabled, false) ret = nil @edit_touched = false while true any_items = UI.QueryWidget(Id(:tab), :CurrentItem) != nil UI.ChangeWidget(Id(:edit), :Enabled, any_items) UI.ChangeWidget(Id(:delete), :Enabled, any_items) # Kludge, because a `Table still does not have a shortcut. UI.SetFocus(Id(:tab)) ret = Convert.to_symbol(UI.UserInput) ret = :abort if ret == :cancel if Builtins.contains([:add, :edit, :delete], ret) vu = EditTable( ret, vu, ["alias", "destinations"], fun_ref(method(:AliasPopup), "map (map, list <map>)"), :tab ) elsif ret == :abort && Popup.ReallyAbort(Mail.touched || @edit_touched) || ret == :next || ret == :back break end end if ret == :next Mail.Touch(Mail.virtual_users != vu) Mail.virtual_users = deep_copy(vu) end Wizard.RestoreScreenShotName ret end |
- (Object) WriteDialog
Write settings dialog
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File '../../src/include/mail/ui.rb', line 165 def WriteDialog if Mode.screen_shot Builtins.y2milestone("Screenshot mode - skipping Write") return :next end # Install packages if needed. # Cannot do it in Write, autoinstall does it differently. if Ops.greater_than(Builtins.size(Mail.install_packages), 0) || Ops.greater_than(Builtins.size(Mail.remove_packages), 0) Package.DoInstallAndRemove(Mail.install_packages, Mail.remove_packages) end # Set help text Wizard.RestoreHelp(WriteDialogHelp()) # A callback function for abort callback = lambda { UI.PollInput == :abort } # Read the configuration was_ok = Mail.Write(callback) # TODO FIXME possibly handle the abort was_ok ? :next : :abort end |