1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
package NewAddressTab;
use strict;
use warnings;
use blib;
use QtCore4;
use QtGui4;
use QtCore4::isa qw( Qt::Widget );
use QtCore4::slots
addEntry => [];
use QtCore4::signals
sendDetails => ['QString', 'QString'];
use AddDialog;
sub NEW {
my ( $class, $parent ) = @_;
$class->SUPER::NEW( $parent );
my $descriptionLabel = Qt::Label(this->tr('There are currently no contacts in your address book. ' .
"\nClick Add to add new contacts."));
my $addButton = Qt::PushButton(this->tr('Add'));
this->connect($addButton, SIGNAL 'clicked()', this, SLOT 'addEntry()');
my $mainLayout = Qt::VBoxLayout();
$mainLayout->addWidget($descriptionLabel);
$mainLayout->addWidget($addButton, 0, Qt::AlignCenter());
this->setLayout($mainLayout);
}
sub addEntry {
my $aDialog = AddDialog();
if ($aDialog->exec()) {
my $name = $aDialog->nameText()->text();
my $address = $aDialog->addressText()->toPlainText();
emit sendDetails($name, $address);
}
}
1;
|