35 #include <KPIMUtils/Email>
36 #include <KDE/KPIMIdentities/Identity>
37 #include <KDE/KPIMIdentities/IdentityCombo>
38 #include <KDE/KPIMIdentities/IdentityManager>
40 #include <KDE/Mailtransport/Transport>
41 #include <KDE/Mailtransport/TransportComboBox>
42 #include <KDE/Mailtransport/TransportManager>
45 #include <KIconLoader>
47 #include <KMessageBox>
52 #include <QPushButton>
54 #include <QHBoxLayout>
55 #include <QFormLayout>
57 using namespace MailCommon;
61 class RedirectDialog::Private
70 mComboboxIdentity( 0 ),
71 mTransportCombobox( 0 )
82 void slotAddressChanged(
const QString & );
83 QString redirectLabelType(TypeAddress type)
const;
90 KPIMIdentities::IdentityCombo *mComboboxIdentity;
91 MailTransport::TransportComboBox *mTransportCombobox;
94 QString RedirectDialog::Private::redirectLabelType(TypeAddress type)
const
99 label = i18n(
"Resend-To:");
102 label = i18n(
"Resend-Cc:");
105 label = i18n(
"Resend-Bcc:");
111 void RedirectDialog::Private::slotUser1()
117 void RedirectDialog::Private::slotUser2()
123 void RedirectDialog::Private::slotAddressChanged(
const QString &
text )
126 q->enableButton( KDialog::User1, textIsNotEmpty );
127 q->enableButton( KDialog::User2, textIsNotEmpty );
131 :
KDialog( parent ), d( new Private( this, mode ) )
133 setCaption( i18n(
"Redirect Message" ) );
134 setButtons( User1 | User2 | Cancel );
135 setDefaultButton( mode ==
SendNow ? User1 : User2 );
138 setMainWidget(mainWidget);
142 QLabel *LabelTo =
new QLabel( i18n(
"Select the recipient addresses to redirect:" ));
150 formLayout->
addRow(d->redirectLabelType(RedirectDialog::Private::ResendTo), d->mEditTo);
152 connect( d->mEditTo, SIGNAL(addressChanged(
QString)), SLOT(slotAddressChanged(
QString)) );
155 formLayout->
addRow(d->redirectLabelType(RedirectDialog::Private::ResendCc), d->mEditCc);
157 formLayout->
addRow(d->redirectLabelType(RedirectDialog::Private::ResendBcc), d->mEditBcc);
158 d->mEditTo->setFocus();
164 d->mComboboxIdentity =
new KPIMIdentities::IdentityCombo(
KernelIf->identityManager());
166 lab->
setBuddy(d->mComboboxIdentity);
170 lab =
new QLabel(i18n(
"Transport:"));
172 d->mTransportCombobox =
new MailTransport::TransportComboBox;
174 lab->
setBuddy(d->mTransportCombobox);
176 setButtonGuiItem( User1, KGuiItem( i18n(
"&Send Now" ),
QLatin1String(
"mail-send") ) );
177 setButtonGuiItem( User2, KGuiItem( i18n(
"Send &Later" ),
QLatin1String(
"mail-queue") ) );
178 connect(
this, SIGNAL(user1Clicked()),
this, SLOT(slotUser1()) );
179 connect(
this, SIGNAL(user2Clicked()),
this, SLOT(slotUser2()) );
180 enableButton( User1,
false );
181 enableButton( User2,
false );
191 return d->mEditTo->resend();
196 return d->mEditCc->resend();
201 return d->mEditBcc->resend();
211 return d->mTransportCombobox->currentTransportId();
216 return static_cast<int>(d->mComboboxIdentity->currentIdentity());
221 const QString editTo = d->mEditTo->resend();
225 i18n(
"You cannot redirect the message without an address." ),
226 i18n(
"Empty Redirection Address" ) );
232 #include "moc_redirectdialog.cpp"
A dialog to request information about message redirection from the user.
QString to() const
Returns the addresses for the redirection.
void setBuddy(QWidget *buddy)
SendMode sendMode() const
Returns the send mode.
SendMode
Describes the send mode.
RedirectDialog(SendMode mode=SendNow, QWidget *parent=0)
Creates a new redirect dialog.
~RedirectDialog()
Destroys the redirect dialog.
void setSpacing(int spacing)
void addLayout(QLayout *layout, int stretch)