Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset e0cf963 in mainline


Ignore:
Timestamp:
2021-09-29T14:30:00Z (4 weeks ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
9bf5da6f
Parents:
6c0766b
git-author:
Jiri Svoboda <jiri@…> (2021-09-28 14:29:47)
git-committer:
Jiri Svoboda <jiri@…> (2021-09-29 14:30:00)
Message:

Set initial entry text for prompt and file dialog

Location:
uspace
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/edit/edit.c

    r6c0766b re0cf963  
    928928static void file_save_as(void)
    929929{
    930 //      const char *old_fname = (doc.file_name != NULL) ? doc.file_name : "";
     930        const char *old_fname = (doc.file_name != NULL) ? doc.file_name : "";
    931931        ui_file_dialog_params_t fdparams;
    932932        ui_file_dialog_t *dialog;
     
    935935        ui_file_dialog_params_init(&fdparams);
    936936        fdparams.caption = "Save As";
    937         // TODO: Set initial file name to old_fname
     937        fdparams.ifname = old_fname;
    938938
    939939        rc = ui_file_dialog_create(edit.ui, &fdparams, &dialog);
     
    18211821        pdparams.caption = reverse ? "Reverse Search" : "Search";
    18221822        pdparams.prompt = "Search text";
    1823 
    1824 //      const char *default_value = "";
    1825 //      if (pane.previous_search)
    1826 //              default_value = pane.previous_search;
     1823        pdparams.itext = "";
     1824
     1825        if (pane.previous_search)
     1826                pdparams.itext = pane.previous_search;
    18271827
    18281828        rc = ui_prompt_dialog_create(edit.ui, &pdparams, &dialog);
  • uspace/lib/ui/include/types/ui/filedialog.h

    r6c0766b re0cf963  
    4949        /** Window caption */
    5050        const char *caption;
     51        /** Initial file name */
     52        const char *ifname;
    5153} ui_file_dialog_params_t;
    5254
  • uspace/lib/ui/include/types/ui/promptdialog.h

    r6c0766b re0cf963  
    5151        /** Prompt text */
    5252        const char *prompt;
     53        /** Initial entry text */
     54        const char *itext;
    5355} ui_prompt_dialog_params_t;
    5456
  • uspace/lib/ui/src/filedialog.c

    r6c0766b re0cf963  
    7676{
    7777        memset(params, 0, sizeof(ui_file_dialog_params_t));
     78        params->ifname = "";
    7879}
    7980
     
    159160        label = NULL;
    160161
    161         rc = ui_entry_create(window, "", &entry);
     162        rc = ui_entry_create(window, params->ifname, &entry);
    162163        if (rc != EOK)
    163164                goto error;
     
    183184
    184185        ui_entry_activate(entry);
     186
     187        /* Select all */
     188        ui_entry_seek_start(entry, false);
     189        ui_entry_seek_end(entry, true);
    185190
    186191        dialog->ename = entry;
  • uspace/lib/ui/src/promptdialog.c

    r6c0766b re0cf963  
    7676{
    7777        memset(params, 0, sizeof(ui_prompt_dialog_params_t));
     78        params->itext = "";
    7879}
    7980
     
    159160        label = NULL;
    160161
    161         rc = ui_entry_create(window, "", &entry);
     162        rc = ui_entry_create(window, params->itext, &entry);
    162163        if (rc != EOK)
    163164                goto error;
     
    183184
    184185        ui_entry_activate(entry);
     186
     187        /* Select all */
     188        ui_entry_seek_start(entry, false);
     189        ui_entry_seek_end(entry, true);
    185190
    186191        dialog->ename = entry;
Note: See TracChangeset for help on using the changeset viewer.