<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w
# This file was preprocessed, do not edit!


package Debconf::FrontEnd::Kde;
use strict;
use utf8;
use Debconf::Gettext;
use Debconf::Config;
BEGIN {
	eval { require QtCore4 };
	die "Unable to load QtCore -- is libqtcore4-perl installed?\n" if $@;
	eval { require QtGui4 };
	die "Unable to load QtGui -- is libqtgui4-perl installed?\n" if $@;
}
use Debconf::FrontEnd::Kde::Wizard;
use Debconf::Log ':all';
use base qw{Debconf::FrontEnd};
use Debconf::Encoding qw(to_Unicode);



our @ARGV_KDE=();

sub init {
	my $this=shift;
    
	$this-&gt;SUPER::init(@_);
	$this-&gt;interactive(1);
	$this-&gt;cancelled(0);
	$this-&gt;createdelements([]);
	$this-&gt;dupelements([]);
	$this-&gt;capb('backup');
	$this-&gt;need_tty(0);

	if (fork) {
		wait(); # for child
		if ($? != 0) {
			die "DISPLAY problem?\n";
		}
	}
	else {
		$this-&gt;qtapp(Qt::Application(\@ARGV_KDE));
		exit(0); # success
	}
	
	$this-&gt;window_initted(0);
	$this-&gt;kde_initted(0);
}

sub init_kde {
	my $this=shift;

	return if $this-&gt;kde_initted;

	debug frontend =&gt; "QTF: initializing app";
	$this-&gt;qtapp(Qt::Application(\@ARGV_KDE));
	$this-&gt;kde_initted(1);
}

sub init_window {
	my $this=shift;
	$this-&gt;init_kde();
	return if $this-&gt;window_initted;
	$this-&gt;{vbox} = Qt::VBoxLayout;

	debug frontend =&gt; "QTF: initializing wizard";
	$this-&gt;win(Debconf::FrontEnd::Kde::Wizard(undef,undef, $this));
	debug frontend =&gt; "QTF: setting size";
	$this-&gt;win-&gt;resize(620, 430);
	my $hostname = `hostname`;
	chomp $hostname;
	$this-&gt;hostname($hostname);
	debug frontend =&gt; "QTF: setting title";
	$this-&gt;win-&gt;setTitle(to_Unicode(sprintf(gettext("Debconf on %s"), $this-&gt;hostname)));
	debug frontend =&gt; "QTF: initializing main widget";
	$this-&gt;{toplayout} = Qt::HBoxLayout();
	$this-&gt;win-&gt;setMainFrameLayout($this-&gt;toplayout);
	$this-&gt;win-&gt;setTitle(to_Unicode(sprintf(gettext("Debconf on %s"), $this-&gt;hostname)));
	$this-&gt;window_initted(1);
}


sub go {
	my $this=shift;
	my @elements=@{$this-&gt;elements};
	

	$this-&gt;init_window;


	my $interactive='';
	debug frontend =&gt; "QTF: -- START ------------------";
	foreach my $element (@elements) {
		next unless $element-&gt;can("create");
		
		$element-&gt;create($this-&gt;frame);
		$interactive=1;
		debug frontend =&gt; "QTF: ADD: " . $element-&gt;question-&gt;description;
		$this-&gt;{vbox}-&gt;addWidget($element-&gt;top);
	}

	if ($interactive) {
		foreach my $element (@elements) {
			next unless $element-&gt;top;
			debug frontend =&gt; "QTF: SHOW: " . $element-&gt;question-&gt;description;
			$element-&gt;top-&gt;show;
		}
		my $scroll = Qt::ScrollArea($this-&gt;win);
		my $widget = Qt::Widget($scroll);
		$widget-&gt;setLayout($this-&gt;{vbox});
		$scroll-&gt;setWidget($widget);
		$this-&gt;toplayout-&gt;addWidget($scroll);
	
	
		if ($this-&gt;capb_backup) {
			$this-&gt;win-&gt;setBackEnabled(1);
		}
		else {
			$this-&gt;win-&gt;setBackEnabled(0);
		}
		$this-&gt;win-&gt;setNextEnabled(1);
	
		$this-&gt;win-&gt;show;
		debug frontend =&gt; "QTF: -- ENTER EVENTLOOP --------";
		$this-&gt;qtapp-&gt;exec;
		$this-&gt;qtapp-&gt;exit;
		debug frontend =&gt; "QTF: -- LEFT EVENTLOOP --------";
			
		$this-&gt;win-&gt;destroy();
		$this-&gt;window_initted(0);
		
		
	} else {
		foreach my $element (@elements) {
			$element-&gt;show;
		}
	}

	debug frontend =&gt; "QTF: -- END --------------------";
	if ($this-&gt;cancelled) {
		exit 1;
	}
	return '' if $this-&gt;goback;
	return 1;
}

sub progress_start {
	my $this=shift;
	$this-&gt;init_window;
	$this-&gt;SUPER::progress_start(@_);

	my $element=$this-&gt;progress_bar;
	$this-&gt;{vbox}-&gt;addWidget($element-&gt;top);
	$element-&gt;top-&gt;show;
	my $scroll = Qt::ScrollArea($this-&gt;win);
	my $widget = Qt::Widget($scroll);
	$widget-&gt;setLayout($this-&gt;{vbox});
	$scroll-&gt;setWidget($widget);
	$this-&gt;toplayout-&gt;addWidget($scroll);
	$this-&gt;win-&gt;setBackEnabled(0);
	$this-&gt;win-&gt;setNextEnabled(0);
	$this-&gt;win-&gt;show;
	$this-&gt;qtapp-&gt;processEvents;
}

sub progress_set {
	my $this=shift;
	my $ret=$this-&gt;SUPER::progress_set(@_);

	$this-&gt;qtapp-&gt;processEvents;

	return $ret;
}

sub progress_info {
	my $this=shift;
	my $ret=$this-&gt;SUPER::progress_info(@_);

	$this-&gt;qtapp-&gt;processEvents;

	return $ret;
}

sub progress_stop {
	my $this=shift;
	my $element=$this-&gt;progress_bar;
	$this-&gt;SUPER::progress_stop(@_);

	$this-&gt;qtapp-&gt;processEvents;

	$this-&gt;win-&gt;setAttribute(Qt::WA_DeleteOnClose());
	$this-&gt;win-&gt;close;
	$this-&gt;window_initted(0);

	if ($this-&gt;cancelled) {
		exit 1;
	}
}


sub shutdown {
	my $this = shift;
	if ($this-&gt;kde_initted) {
		if($this-&gt;win) {
			$this-&gt;win-&gt;destroy;
		}
	}
}


1
</pre></body></html>