-rw-r--r-- | noncore/settings/mediummount/mediumwidget.cc | 23 | ||||
-rw-r--r-- | noncore/settings/mediummount/mediumwidget.h | 2 |
2 files changed, 22 insertions, 3 deletions
diff --git a/noncore/settings/mediummount/mediumwidget.cc b/noncore/settings/mediummount/mediumwidget.cc index caa9559..f39a6ed 100644 --- a/noncore/settings/mediummount/mediumwidget.cc +++ b/noncore/settings/mediummount/mediumwidget.cc @@ -117,25 +117,29 @@ void MediumMountWidget::initGUI() m_hboxAdd = new QHBox( this ); m_add = new QPushButton(m_hboxAdd ); m_add->setText( tr("Add") ); m_del = new QPushButton(m_hboxAdd); m_del->setText(tr("Remove")); connect(m_add, SIGNAL(clicked() ), this, SLOT(slotAdd() ) ); connect(m_del, SIGNAL(clicked() ), this, SLOT(slotRemove() ) ); m_box->addWidget(m_hboxAdd ); - + m_scan_all_check = new QCheckBox( tr("Scan whole media"), this ); + connect(m_scan_all_check,SIGNAL(stateChanged(int)),this,SLOT(slotScanAllChanged(int))); + + m_box->addWidget(m_scan_all_check); + m_always = new QCheckBox( tr("Always check this medium"), this ); m_box->addWidget( m_always ); QSpacerItem *item = new QSpacerItem(5, 50, QSizePolicy::Fixed, QSizePolicy::Expanding ); m_box->addItem(item ); } void MediumMountWidget::readConfig( ) { @@ -160,54 +164,59 @@ void MediumMountWidget::readConfig( ) m_all->setChecked( false ); m_audio->setChecked( m_config->readBoolEntry("audio", true ) ); m_image->setChecked( m_config->readBoolEntry("image", true ) ); m_text->setChecked ( m_config->readBoolEntry("text" , true ) ); m_video->setChecked( m_config->readBoolEntry("video", true ) ); }; m_config->setGroup("subdirs"); QStringList entries = m_config->readListEntry("subdirs",':'); m_subList->clear(); m_subList->insertStringList(entries); + m_scan_all_check->setChecked(m_config->readBoolEntry("wholemedia",true)); } void MediumMountWidget::writeConfig() { m_config->setGroup("main"); m_config->writeEntry("check", m_always->isChecked() ); m_config->setGroup("mimetypes" ); if(m_all->isChecked() ){ m_config->writeEntry("all", true ); }else{ m_config->writeEntry("audio", m_audio->isChecked() ); m_config->writeEntry("image", m_image->isChecked() ); m_config->writeEntry("text" , m_text->isChecked() ); m_config->writeEntry("video", m_video->isChecked() ); } m_config->setGroup("subdirs"); QStringList entries; QString ctext; for (int i = 0; i < m_subList->count();++i) { ctext = m_subList->text(i); if (ctext.isEmpty()) continue; - if (ctext.startsWith("/")&&ctext.length()>1) { + if (ctext.startsWith("/")) { ctext = ctext.right(ctext.length()-1); } - entries.append(ctext); + if (!ctext.isEmpty()) { + entries.append(ctext); + } } m_config->writeEntry("subdirs",entries,':'); + m_config->writeEntry("wholemedia",m_scan_all_check->isChecked()); } + MediumMountWidget::~MediumMountWidget() { delete m_config; } void MediumMountWidget::slotAdd() { if (m_subList->currentText()==m_subList->text(m_subList->currentItem())) return; m_subList->insertItem(m_subList->currentText()); } @@ -222,12 +231,20 @@ void MediumMountWidget::slotRemove() } void MediumMountWidget::slotStateChanged() { bool state = !(m_all->isChecked()); m_audio->setEnabled( state ); m_text->setEnabled ( state ); m_video->setEnabled( state ); m_image->setEnabled( state ); } + +void MediumMountWidget::slotScanAllChanged(int) +{ + bool state = !(m_scan_all_check->isChecked()); + m_add->setEnabled(state); + m_del->setEnabled(state); + m_subList->setEnabled(state); +} diff --git a/noncore/settings/mediummount/mediumwidget.h b/noncore/settings/mediummount/mediumwidget.h index 28ae369..ae5c5dc 100644 --- a/noncore/settings/mediummount/mediumwidget.h +++ b/noncore/settings/mediummount/mediumwidget.h @@ -26,24 +26,25 @@ namespace MediumMountSetting { Q_OBJECT public: MediumMountWidget(const QString&, const QPixmap &, QWidget *parent, const char *name = 0 ); ~MediumMountWidget(); void writeConfig(); private slots: void slotAdd(); void slotRemove(); void slotStateChanged(); + void slotScanAllChanged(int); private: void readConfig(); void initGUI(); bool m_dirty : 1; class MediumMountWidgetPrivate; MediumMountWidgetPrivate *d; QString m_path; @@ -58,24 +59,25 @@ namespace MediumMountSetting { QPushButton *m_del; QVBoxLayout *m_box; QGridLayout *m_checks; QGroupBox *m_group; QCheckBox *m_all; QCheckBox *m_audio; QCheckBox *m_image; QCheckBox *m_text; QCheckBox *m_video; + QCheckBox *m_scan_all_check; QCheckBox *m_always; //QCheckBox *m_yesNo; QHBox *m_hboxAdd; QLabel *m_lblPath; //////////////// }; }; |