1 /***************************************************************************
2 * Copyright (c) 2006, 2007 *
3 * Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
22 #include "magnatunedownloaddialog.h"
26 #include <kfiledialog.h>
27 #include <kurlrequester.h>
29 #include <q3textedit.h>
35 MagnatuneDownloadDialog::MagnatuneDownloadDialog( QWidget
*parent
, const char *name
, bool modal
, Qt::WFlags fl
)
36 : QDialog( parent
, fl
)
38 downloadTargetURLRequester
->fileDialog() ->setMode( KFile::Directory
);
39 m_currentDownloadInfo
= 0;
43 MagnatuneDownloadDialog::~MagnatuneDownloadDialog()
45 delete m_currentDownloadInfo
;
49 void MagnatuneDownloadDialog::downloadButtonClicked( )
52 if (m_currentDownloadInfo
== 0) return;
54 m_currentDownloadInfo
->setFormatSelection(formatComboBox
->currentText());
56 KUrl unpackLocation
= downloadTargetURLRequester
->url();
57 unpackLocation
.adjustPath(KUrl::AddTrailingSlash
);
58 m_currentDownloadInfo
->setUnpackUrl( unpackLocation
.directory( KUrl::ObeyTrailingSlash
) );
60 emit( downloadAlbum( m_currentDownloadInfo
) );
66 void MagnatuneDownloadDialog::setDownloadInfo( MagnatuneDownloadInfo
* info
)
68 delete m_currentDownloadInfo
;
70 m_currentDownloadInfo
= info
;
72 DownloadFormatMap formatMap
= info
->getFormatMap();
74 DownloadFormatMap::Iterator it
;
76 for ( it
= formatMap
.begin(); it
!= formatMap
.end(); ++it
)
78 formatComboBox
->addItem( it
.key() );
81 infoEdit
->setText( info
->getDownloadMessage() );
88 #include "magnatunedownloaddialog.moc"