30#include "redirectdialog.h"
33#include "kmlineeditspell.h"
35#include <libemailfunctions/email.h>
36#include <addressesdialog.h>
37using KPIM::AddressesDialog;
38#include "recentaddresses.h"
39using TDERecentAddress::RecentAddresses;
41#include <kiconloader.h>
43#include <tdemessagebox.h>
48#include <tqwhatsthis.h>
50#include <tqpushbutton.h>
51#include <tqstringlist.h>
56 bool modal, bool immediate )
57 : KDialogBase( parent, name, modal, i18n( "Redirect Message" ),
58 User1|User2|Cancel, ( immediate ? User1 : User2 ), false )
60 TQVBox *vbox = makeVBoxMainWidget();
61 mLabelTo = new TQLabel( i18n( "Select the recipient &addresses "
62 "to redirect to:" ), vbox );
64 TQHBox *hbox = new TQHBox( vbox );
66 mEditTo = new KMLineEdit( true, hbox, "toLine" );
67 mEditTo->setMinimumWidth( 300 );
69 mBtnTo = new TQPushButton( TQString(), hbox, "toBtn" );
70 mBtnTo->setPixmap( BarIcon( "contents", TDEIcon::SizeSmall ) );
71 mBtnTo->setMinimumSize( mBtnTo->sizeHint() * 1.2 );
72 TQToolTip::add( mBtnTo, i18n( "Use the Address-Selection Dialog") );
73 TQWhatsThis::add( mBtnTo, i18n( "This button opens a separate dialog "
74 "where you can select recipients out "
75 "of all available addresses." ) );
77 connect( mBtnTo, TQ_SIGNAL(clicked()), TQ_SLOT( slotAddrBook()) );
79 connect( mEditTo, TQ_SIGNAL( textChanged ( const TQString & ) ), TQ_SLOT( slotEmailChanged( const TQString & ) ) );
80 mLabelTo->setBuddy( mBtnTo );
83 setButtonGuiItem( User1, KGuiItem( i18n( "&Send Now"), "mail-send" ) );
84 setButtonGuiItem( User2, KGuiItem( i18n( "Send &Later"), "queue" ) );
85 enableButton( User1, false );
86 enableButton( User2, false );
90void RedirectDialog::slotEmailChanged( const TQString & text )
92 enableButton( User1, !text.isEmpty() );
93 enableButton( User2, !text.isEmpty() );
97void RedirectDialog::slotUser1()
104void RedirectDialog::slotUser2()
113 mResentTo = mEditTo->text();
114 if ( mResentTo.isEmpty() ) {
115 KMessageBox::sorry( this,
116 i18n( "You cannot redirect the message without an address."),
117 i18n( "Empty Redirection Address") );
126 AddressesDialog dlg( this );
128 mResentTo = mEditTo->text();
129 if ( !mResentTo.isEmpty() ) {
130 TQStringList lst = KPIM::splitEmailAddrList( mResentTo );
131 dlg.setSelectedTo( lst );
134 dlg.setRecentAddresses(
135 RecentAddresses::self( KMKernel::config() )->tdeabcAddresses() );
139 dlg.setShowCC( false );
140 dlg.setShowBCC( false );
142 if (dlg.exec()==TQDialog::Rejected) return;
144 mEditTo->setText( dlg.to().join( ", ") );
145 mEditTo->setEdited( true );
149#include "redirectdialog.moc"
void slotAddrBook() Open addressbook editor dialog.
RedirectDialog(TQWidget *parent=0, const char *name=0, bool modal=false, bool immediate=true) Constructor.
void accept() Evaluate the settings, an empty To field is not allowed.
|