From a3f3aba32248f703735ee83612d17da128f38185 Mon Sep 17 00:00:00 2001 From: Andreas Loibl Date: Thu, 17 Mar 2011 16:49:48 +0100 Subject: min window size, "sudo gparted" fix --- backend/backend.sh.in | 44 +++++++++++++++++++++++++++----------------- backend/modules/partmgr | 2 ++ mainwizard.cpp | 2 ++ 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/backend/backend.sh.in b/backend/backend.sh.in index 4c0c161..e461387 100755 --- a/backend/backend.sh.in +++ b/backend/backend.sh.in @@ -36,28 +36,36 @@ function set_debug() esac } -if ((UID)); then - p="$PWD/$(basename "$0")" - if [ -x /usr/bin/sudo ]; then - if /usr/bin/sudo -n -l "$p" &>/dev/null; then - /usr/bin/sudo "$p" "$@" +# Synopsis: get_root ["X"] +# +# This function makes sure the user has root-privileges. +# Argument X means it won't use "sudo" to gain root-privileges, because sudo doesn't support X-applications +function get_root() +{ + if ((UID)); then + p="$PWD/$(basename "$0")" + if [ -x /usr/bin/sudo -a "$1" != "X" ]; then + if /usr/bin/sudo -n -l "$p" &>/dev/null; then + /usr/bin/sudo "$p" "${O_ARGS[@]}" + exit $? + fi + fi + if [ -x /usr/lib/kde4/libexec/kdesu ]; then + /usr/lib/kde4/libexec/kdesu --noignorebutton -d -- "$p" --pid $$ "${O_ARGS[@]}" &>/dev/null exit $? fi - fi - if [ -x /usr/lib/kde4/libexec/kdesu ]; then - /usr/lib/kde4/libexec/kdesu --noignorebutton -d -- "$p" --pid $$ "$@" &>/dev/null + if [ -z "$as_root" ]; then + for as_root in /usr/bin/kdesu /usr/bin/gksu exec + do + [ -x $as_root ] && break + done + fi + $as_root "$p" --pid $$ "${O_ARGS[@]}" &>/dev/null exit $? fi - if [ -z "$as_root" ]; then - for as_root in /usr/bin/kdesu /usr/bin/gksu exec - do - [ -x $as_root ] && break - done - fi - $as_root "$p" --pid $$ "$@" &>/dev/null - exit $? -fi +} +O_ARGS=( "${@}" ) while [ "$1" ] do case $1 in @@ -80,6 +88,8 @@ do shift done +get_root + EOT="$(echo -e '\004')" while true do diff --git a/backend/modules/partmgr b/backend/modules/partmgr index c773e8d..618406b 100644 --- a/backend/modules/partmgr +++ b/backend/modules/partmgr @@ -4,9 +4,11 @@ function run_partmgr() { case "$1" in cfdisk|fdisk) + get_root TERM=xterm /sbin/"$1" "$2" ;; gparted|qtparted) + get_root X "$1" "$2" ;; esac diff --git a/mainwizard.cpp b/mainwizard.cpp index 25df6f1..a54b98d 100644 --- a/mainwizard.cpp +++ b/mainwizard.cpp @@ -17,6 +17,8 @@ MainWizard::MainWizard() { + setMinimumSize(QSize(640,480)); + backend = Backend::instance(); backend->runBackend(); -- cgit v1.0