19 #include "importarchivedialog.h"
22 #include "folderrequester.h"
23 #include "kmmainwidget.h"
24 #include "importjob.h"
26 #include <kurlrequester.h>
27 #include <tdelocale.h>
28 #include <tdemessagebox.h>
33 using namespace KMail;
35 ImportArchiveDialog::ImportArchiveDialog( TQWidget *parent, TQt::WidgetFlags flags )
36 : KDialogBase( parent,
"import_archive_dialog", false, i18n(
"Import Archive" ),
37 KDialogBase::
Ok | KDialogBase::Cancel,
38 KDialogBase::
Ok, true ),
39 mParentWidget( parent )
42 TQWidget *mainWidget =
new TQWidget(
this );
43 TQGridLayout *mainLayout =
new TQGridLayout( mainWidget );
44 mainLayout->setSpacing( KDialog::spacingHint() );
45 mainLayout->setMargin( KDialog::marginHint() );
46 setMainWidget( mainWidget );
54 TQLabel *folderLabel =
new TQLabel( i18n(
"&Folder:" ), mainWidget );
55 mainLayout->addWidget( folderLabel, row, 0 );
56 mFolderRequester =
new FolderRequester( mainWidget, kmkernel->getKMMainWidget()->folderTree() );
57 folderLabel->setBuddy( mFolderRequester );
58 mainLayout->addWidget( mFolderRequester, row, 1 );
61 TQLabel *fileNameLabel =
new TQLabel( i18n(
"&Archive File:" ), mainWidget );
62 mainLayout->addWidget( fileNameLabel, row, 0 );
63 mUrlRequester =
new KURLRequester( mainWidget );
64 mUrlRequester->setMode( KFile::LocalOnly );
65 mUrlRequester->setFilter(
"*.tar *.zip *.tar.gz *.tar.bz2" );
66 fileNameLabel->setBuddy( mUrlRequester );
67 mainLayout->addWidget( mUrlRequester, row, 1 );
72 mainLayout->setColStretch( 1, 1 );
73 mainLayout->addItem(
new TQSpacerItem( 1, 1, TQSizePolicy::Expanding, TQSizePolicy::Expanding ), row, 0 );
76 resize( 500, minimumSize().height() );
79 void ImportArchiveDialog::setFolder(
KMFolder *defaultFolder )
81 mFolderRequester->setFolder( defaultFolder );
84 void ImportArchiveDialog::slotOk()
86 if ( !TQFile::exists( mUrlRequester->url() ) ) {
87 KMessageBox::information(
this, i18n(
"Please select an archive file that should be imported." ),
88 i18n(
"No archive file selected" ) );
92 if ( !mFolderRequester->folder() ) {
93 KMessageBox::information(
this, i18n(
"Please select the folder where the archive should be imported to." ),
94 i18n(
"No target folder selected" ) );
101 importJob->setFile( mUrlRequester->url() );
102 importJob->setRootFolder( mFolderRequester->folder() );
107 #include "importarchivedialog.moc"
A widget that contains a KLineEdit which shows the current folder and a button that fires a KMFolderS...
Imports an archive that was previously backed up with an BackupJob.
@ Ok
The user rights/ACL have been fetched from the server sucessfully.