00001 #include "mediadlg.h"
00002 #include "mediumwidget.h"
00003 #include <qtopia/storage.h>
00004 #include <qpixmap.h>
00005 #include <qlayout.h>
00006 #include <qlabel.h>
00007
00008 Mediadlg::Mediadlg(FileSystem*fs,QWidget *parent, const char *name, bool modal, WFlags fl)
00009 : QDialog(parent,name,modal,fl)
00010 {
00011 m_fs = fs;
00012 m_widget = 0;
00013 init();
00014 }
00015
00016 Mediadlg::~Mediadlg()
00017 {
00018 }
00019
00020 void Mediadlg::init()
00021 {
00022 if (!m_fs) return;
00023 m_lay = new QVBoxLayout( this);
00024 m_lay->setSpacing(0);
00025 m_lay->setMargin(0);
00026 QLabel*tLabel = new QLabel(this);
00027 tLabel->setText("<center>"+tr("A new storage media detected:")+"<br>"+m_fs->name()+"<br>"+tr("What should I do with it?")+"</center>");
00028 m_lay->addWidget(tLabel);
00029 m_widget = new MediumMountSetting::MediumMountWidget(m_fs->path(),QPixmap(),this);
00030 m_lay->addWidget(m_widget);
00031 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
00032 m_lay->addItem(spacer);
00033 }
00034
00035 void Mediadlg::accept()
00036 {
00037 if (m_widget) m_widget->writeConfig();
00038 QDialog::accept();
00039 }