summaryrefslogtreecommitdiffstats
path: root/ksirc/puke/dcc_progress.pm
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /ksirc/puke/dcc_progress.pm
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksirc/puke/dcc_progress.pm')
-rw-r--r--ksirc/puke/dcc_progress.pm55
1 files changed, 55 insertions, 0 deletions
diff --git a/ksirc/puke/dcc_progress.pm b/ksirc/puke/dcc_progress.pm
new file mode 100644
index 00000000..a21ee26e
--- /dev/null
+++ b/ksirc/puke/dcc_progress.pm
@@ -0,0 +1,55 @@
+
+&docommand("/load pprogress.pm");
+
+package DCCProgress;
+
+@ISA = qw(PProgress);
+use strict;
+
+sub new {
+ my $class = shift;
+ my $self = $class->SUPER::new($class, @_);
+
+ $self->create();
+
+ $self->installHandler($::PUKE_KSPROGRESS_CANCEL_ACK,
+ sub {$self->cancelPressed(@_)});
+
+ return $self;
+}
+
+
+sub setRange {
+ my $self = shift;
+ my $min = shift;
+ my $max = shift;
+
+ $self->{'min'} = $min;
+ $self->{'max'} = $max;
+ $self->{'step'} = ($max - $min) / 100;
+ $self->{'step'} = 10240 if $self->{'step'} == 0; # if sized messed don't divide by 0 :)
+ $self->PProgress::setRange(0, 100);
+}
+
+sub setValue {
+ my $self = shift;
+
+ my $value = shift;
+
+ my $steps = int($value / $self->{'step'});
+
+ $self->PProgress::setValue($steps);
+}
+
+sub setCancel {
+ my $self = shift;
+ $self->{'cancelMessage'} = shift;
+}
+
+sub cancelPressed {
+ my $self = shift;
+
+ &::docommand($self->{'cancelMessage'});
+ $self->hide;
+
+} \ No newline at end of file