- Timestamp:
- Sep 27, 2011, 5:24:40 PM (13 years ago)
- Parents:
- eba02ec (diff), c8ef50b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl.pm
ra130fc5 rc8ef50b 9 9 zephyr_stylestrip zephyr_smartstrip_user zephyr_getsubs 10 10 queue_message admin_message 11 start_edit 11 12 start_question start_password start_edit_win 12 13 get_data_dir get_config_dir popless_text popless_ztext … … 105 106 Enqueue a message in the BarnOwl message list, logging it and 106 107 processing it appropriately. C<MESSAGE> should be an instance of 107 BarnOwl::Message or a subclass. Returns the queued message. This 108 is useful for, e.g., deleting a message from the message list. 108 BarnOwl::Message or a subclass. 109 109 110 110 =head2 admin_message HEADER BODY … … 112 112 Display a BarnOwl B<Admin> message, with the given header and body. 113 113 114 =head2 start_edit %ARGS 115 116 Displays a prompt on the screen and lets the user enter text, 117 and calls a callback when the editwin is closed. 118 119 C<%ARGS> must contain the following keys: 120 121 =over 4 122 123 =item prompt 124 125 The line to display on the screen 126 127 =item type 128 129 One of: 130 131 =over 4 132 133 =item edit_win 134 135 Displays the prompt on a line of its own and opens the edit_win. 136 137 =item question 138 139 Displays prompt on the screen and lets the user enter a line of 140 text. 141 142 =item password 143 144 Like question, but echoes the user's input as C<*>s when they 145 input. 146 147 =back 148 149 =item callback 150 151 A Perl subroutine that is called when the user closes the edit_win. 152 C<CALLBACK> gets called with two parameters: the text the user entered, 153 and a C<SUCCESS> boolean parameter which is false if the user canceled 154 the edit_win and true otherwise. 155 156 =back 157 114 158 =head2 start_question PROMPT CALLBACK 115 159 116 Displays C<PROMPT> on the screen and lets the user enter a line of117 text, and calls C<CALLBACK>, which must be a perl subroutine118 reference, with the text the user entered119 120 160 =head2 start_password PROMPT CALLBACK 121 161 122 Like C<start_question>, but echoes the user's input as C<*>s when they123 input.124 125 162 =head2 start_edit_win PROMPT CALLBACK 126 163 127 Like C<start_question>, but displays C<PROMPT> on a line of its own 128 and opens the editwin. If the user cancels the edit win, C<CALLBACK> 129 is not invoked. 164 Roughly equivalent to C<start_edit> called with the appropriate parameters. 165 C<CALLBACK> is only called on success. 166 167 These are deprecated wrappers around L<BarnOwl::start_edit>, and should not 168 be uesd in new code. 169 170 =cut 171 172 sub start_edit { 173 my %args = (@_); 174 BarnOwl::Internal::start_edit($args{type}, $args{prompt}, $args{callback}); 175 } 176 177 sub start_question { 178 my ($prompt, $callback) = @_; 179 BarnOwl::start_edit(type => 'question', prompt => $prompt, callback => sub { 180 my ($text, $success) = @_; 181 $callback->($text) if $success; 182 }); 183 } 184 185 sub start_password { 186 my ($prompt, $callback) = @_; 187 BarnOwl::start_edit(type => 'password', prompt => $prompt, callback => sub { 188 my ($text, $success) = @_; 189 $callback->($text) if $success; 190 }); 191 } 192 193 sub start_edit_win { 194 my ($prompt, $callback) = @_; 195 BarnOwl::start_edit(type => 'edit_win', prompt => $prompt, callback => sub { 196 my ($text, $success) = @_; 197 $callback->($text) if $success; 198 }); 199 } 130 200 131 201 =head2 get_data_dir
Note: See TracChangeset
for help on using the changeset viewer.