Published using Google Docs
kdialog
Updated automatically every 5 minutes

Introdução

kdialog --help

--msgbox

--textbox

--sorry

--warningyesno

--detailedsorry

--error

--yesno

--yesnocancel

--calendar

--slider

--menu

--checklist

--inputbox

--textinputbox

--password

--getcolor

--combobox

--radiolist

--getopenfilename

--passivepopup

Introdução

kdialog --help

$ kdialog --help

Usage: kdialog [Qt-options] [KDE-options] [options] [arg]

KDialog can be used to show nice dialog boxes from shell scripts

Generic options:

  --help                        Show help about options

  --help-qt                     Show Qt specific options

  --help-kde                    Show KDE specific options

  --help-all                    Show all options

  --author                      Show author information

  -v, --version                 Show version information

  --license                     Show license information

  --                            End of options

Options:

  --yesno <text>                Question message box with yes/no buttons

  --yesnocancel <text>          Question message box with yes/no/cancel buttons

  --warningyesno <text>         Warning message box with yes/no buttons

  --warningcontinuecancel <text> Warning message box with continue/cancel buttons

  --warningyesnocancel <text> Warning message box with yes/no/cancel buttons

  --yes-label <text>            Use text as Yes button label

  --no-label <text>             Use text as No button label

  --cancel-label <text>         Use text as Cancel button label

  --continue-label <text>   Use text as Continue button label

  --sorry <text>                'Sorry' message box

  --detailedsorry <text> <details> 'Sorry' message box with expandable Details field

  --error <text>                'Error' message box

  --detailederror <text> <details> 'Error' message box with expandable Details field

  --msgbox <text>               Message Box dialog

  --inputbox <text> <init>  Input Box dialog

  --password <text>             Password dialog

  --textbox <file> [width] [height] Text Box dialog

  --textinputbox <text> <init> [width] [height] Text Input Box dialog

  --combobox <text> item [item] [item] ... ComboBox dialog

  --menu <text> [tag item] [tag item] ... Menu dialog

  --checklist <text> [tag item status] ... Check List dialog

  --radiolist <text> [tag item status] ... Radio List dialog

  --passivepopup <text> <timeout> Passive Popup

  --getopenfilename [startDir] [filter] File dialog to open an existing file

  --getsavefilename [startDir] [filter] File dialog to save a file

  --getexistingdirectory [startDir] File dialog to select an existing directory

  --getopenurl [startDir] [filter] File dialog to open an existing URL

  --getsaveurl [startDir] [filter] File dialog to save a URL

  --geticon [group] [context] Icon chooser dialog

  --progressbar <text> [totalsteps] Progress bar dialog, returns a D-Bus reference for communication

  --getcolor                    Color dialog to select a color

  --title <text>                Dialog title

  --default <text>              Default entry to use for combobox, menu and color

  --multiple                    Allows the --getopenurl and --getopenfilename options to return multiple files

  --separate-output             Return list items on separate lines (for checklist option and file open with --multiple)

  --print-winid                 Outputs the winId of each dialog

  --dontagain <file:entry>  Config file and option name for saving the "do-not-show/ask-again" state

  --slider <text> [minvalue] [maxvalue] [step] Slider dialog box, returns selected value

  --calendar <text>             Calendar dialog box, returns selected date

  --attach <winid>              Makes the dialog transient for an X app specified by winid

Arguments:

  arg                           Arguments - depending on main option

--msgbox

$ kdialog --msgbox "Seja bem-vindo(a) à Logicus"

Screenshot_20160912_144347.png

$ kdialog --title "Logicus" --msgbox "Seja bem-vindo(a)\nAproveite a leitura deste paper"

$ kdialog --title "Logicus" --dontagain arquivo:entrada --msgbox "Você está logado como usuário comum. Muitas opções podem não func

ionar"

Screenshot_20160916_132917.png

--textbox

$ kdialog --title "Logicus" --textbox /etc/passwd

Screenshot_20160916_135721.png

$ kdialog --title "Logicus" --textbox /etc/passwd 400 700

--sorry

$ kdialog --sorry "Como usuário comum você não terá acesso a todas as configurações. Informações em suporte@logicus.com.br"

Screenshot_20160912_144637.png

--warningyesno

$ kdialog --warningyesno "O usuário joaquim@logicus.com.br já está logado. Deseja entrar em contato com o administrador?"

Screenshot_20160912_145522.png

$ kdialog --title "Logicus Alerta" --warningyesnocancel "Você executou uma ação não autorizada.\nDeseja continuar?"

Screenshot_20160916_121105.png

Yes

0

No

1

Cancel

2

--detailedsorry

$ kdialog --detailedsorry "Ops! Você não está matriculado neste treinamento da Logicus" "Para se matricular é preciso acessar http://logicus.com.br e preecher a ficha de matrícula :)"

Screenshot_20160912_145945.png

--error

$ kdialog --error "Sua senha não confere. Por favor entrar em contato com suporte@logicus.com.br"

Screenshot_20160912_150517.png

--yesno

$ kdialog --yesno "Você já conhecia a Logicus?"

Screenshot_20160912_153811.png

$ kdialog --title "Logicus" --yesno "Esta conexão não possui criptografia. O que deseja fazer?" --yes-label "Acessar mesmo assim" -

-no-label "Encerrar conexão"

Screenshot_20160920_211117.png

--yesnocancel

$ kdialog --yesnocancel "Login na sala de aula Logicus efetuado com sucesso. Deseja continuar?"

Screenshot_20160912_155948.png

--calendar

$ kdialog --title "Logicus" --calendar "Quando iniciar curso?"

Screenshot_20160912_165045.png

--slider

$ kdialog --title "Logicus" --slider "Deslize para atribuir uma nota para o treinamento" 0 100 10

Screenshot_20160912_165711.png

--menu

$ kdialog --title "Logicus" --menu "Escolha um treinamento:" "1" "Linux Profissional" "2" "Lógica de Programação" "3" "LibreOffice"

Screenshot_20160914_220824.png

--checklist

$ kdialog --title "Logicus" --checklist "Escolha mais de um treinamento:" "1" "Linux Profissional" on  "2" "Lógica de Programação" off "3"

"LibreOffice" on

Screenshot_20160916_140717.png

$ kdialog --title "Logicus" --separate-output --checklist "Escolha mais de um treinamento:" "1" "Linux Profissional" on  "2" "Lógica de Programação" off "3" "LibreOffice" on

#!/bin/bash

ESCOLHA=$(kdialog --title "Logicus" \

       --checklist "Escolha os serviços que deseja configurar" 1 "NTP" on 2 "SSH" off 3 "Apache" off);

if [ "$?" = 0 ]; then

       kdialog --msgbox "$ESCOLHA";

elif [ "$?" = 1 ]; then

       kdialog --sorry "Você clicou cancelar";

else

       kdialog --error "ERROR";

fi;

--inputbox

$ kdialog --title "Logicus Adm" --inputbox "Digite o fqdn completo do servidor ntp" "Exemplo florenca.logicus.local"

Screenshot_20160916_145020.png

--textinputbox

$ kdialog --title "Logicus Treinamentos" --textinputbox "Avaliação final do curso" "Digite aqui o que você achou do nosso treinamento"

Screenshot_20160916_105805.png

--password

$ kdialog --title "Logicus" --password "Informe a senha de acesso ao servidor"

Screenshot_20160916_111712.png

#!/bin/bash

kdialog --title "Logicus" --password "Digite a senha do servidor"

if [[ "$?" == "0" ]]; then

       kdialog --msgbox "Ok, você digitou uma senha"

else

       kdialog --msgbox "Ops! Você não digitou uma senha"

fi

#!/bin/bash

while true

do

       SENHA=$(kdialog --title "Logicus" --password "Digite a senha do servidor")

       if [[ "$SENHA" == "segredo" ]]; then

               kdialog --msgbox "Ok, você digitou a senha correta"

       else

               kdialog --msgbox "Ops! Você não digitou a senha correta"

       fi

done

--getcolor

$ kdialog --title "Logicus escolha a cor da tela" --getcolor

Screenshot_20160916_112229.png

--combobox

$ kdialog --title "Logicus" --combobox "Escolha um treinamento" "Linux Profissional" "Programação Shell Script" "Samba 4" "Python com Django" "Amazon Web Services"

Screenshot_20160916_112518.png

--radiolist

$ kdialog --title "Logicus" --radiolist "escolha" "1" "Linux Profissional" off "2" "Alta Disponibilidade" off "3" "Icinga" on

Screenshot_20160916_143737.png

--getopenfilename

$ mkdir /tmp/kdialog

$ touch /tmp/kdialog/arquivo{1..10}.txt

$ touch /tmp/kdialog/arquivo{1..10}.info

$ ls /tmp/kdialog/

arquivo10.info  arquivo1.txt   arquivo3.info  arquivo4.txt   arquivo6.info  arquivo7.txt   arquivo9.info

arquivo10.txt   arquivo2.info  arquivo3.txt   arquivo5.info  arquivo6.txt   arquivo8.info  arquivo9.txt

arquivo1.info   arquivo2.txt   arquivo4.info  arquivo5.txt   arquivo7.info  arquivo8.txt

$ kdialog --getopenfilename /tmp/kdialog/ '*.info'

Screenshot_20160916_151319.png

$ kdialog --title "Logicus Adm" --getopenfilename :"arquivo de configuração"

Screenshot_20160916_153510.png

--passivepopup

$ kdialog --title "Logicus" --passivepopup "Este aviso desaparecerá em 10 segundos" 10

Screenshot_20160916_120419.png