#!/bin/bash
. ./lib

options=()
options+=("chromium" "" on)
options+=("chromium-pepper-flash" "(AUR)" on)
options+=("chromium-pepper-flash-standalone" "(AUR)" off)
options+=("firefox" "" on)
options+=("flashplugin" "" off)
options+=("freshplayerplugin-git" "(AUR)" on)
options+=("freshplayerplugin" "(AUR)" off)
options+=("tixati" "(AUR)" on)
options+=("thunderbird" "" off)

sel=$(whiptail --backtitle "$apptitle" --title "Internet applications :" --checklist "Choose what you want" --cancel-button "Back" 0 0 0 \
  "${options[@]}" \
  3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
  exit 1
fi

for itm in $sel; do
  case $itm in
    '"chromium-pepper-flash"' | \
    '"chromium-pepper-flash-standalone"' | \
    '"freshplayerplugin-git"' | \
    '"freshplayerplugin"' | \
    '"tixati"') aurpkg="$aurpkg $(echo $itm | sed 's/"//g')";;
    *) pkg="$pkg $(echo $itm | sed 's/"//g')";;
  esac
done

instpkg "$pkg" "$aurpkg"

for itm in $sel; do
  case $itm in
    '"firefox"') choosepkg "firefox-i18n-";;
    '"thunderbird"') choosepkg "thunderbird-i18n-";;
  esac
done

exit 0