summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/mediummount/mediumwidget.cc49
-rw-r--r--noncore/settings/mediummount/mediumwidget.h5
2 files changed, 49 insertions, 5 deletions
diff --git a/noncore/settings/mediummount/mediumwidget.cc b/noncore/settings/mediummount/mediumwidget.cc
index 981e1dd..caa9559 100644
--- a/noncore/settings/mediummount/mediumwidget.cc
+++ b/noncore/settings/mediummount/mediumwidget.cc
@@ -13,2 +13,3 @@
#include <qwhatsthis.h>
+#include <qcombobox.h>
@@ -109,11 +110,21 @@ void MediumMountWidget::initGUI()
- // add to
+
+ m_subList = new QComboBox(FALSE,this,"docFolderList");
+ m_subList->setDuplicatesEnabled(FALSE);
+ m_subList->setEditable(TRUE);
+ m_box->addWidget(m_subList);
+
m_hboxAdd = new QHBox( this );
- //m_hboxAdd->setSpacing( 10 );
- m_edit = new QLineEdit(m_hboxAdd );
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_always = new QCheckBox( tr("Always check this medium"), this );
@@ -156,2 +167,6 @@ void MediumMountWidget::readConfig( )
};
+ m_config->setGroup("subdirs");
+ QStringList entries = m_config->readListEntry("subdirs",':');
+ m_subList->clear();
+ m_subList->insertStringList(entries);
}
@@ -172,2 +187,15 @@ void MediumMountWidget::writeConfig()
}
+ 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) {
+ ctext = ctext.right(ctext.length()-1);
+ }
+ entries.append(ctext);
+ }
+ m_config->writeEntry("subdirs",entries,':');
}
@@ -180,4 +208,17 @@ void MediumMountWidget::slotAdd()
{
+ if (m_subList->currentText()==m_subList->text(m_subList->currentItem()))
+ return;
+ m_subList->insertItem(m_subList->currentText());
+}
+void MediumMountWidget::slotRemove()
+{
+ QString text = m_subList->currentText();
+ if (text != m_subList->text(m_subList->currentItem())) {
+ m_subList->clearEdit ();
+ } else {
+ m_subList->removeItem(m_subList->currentItem());
+ }
}
+
void MediumMountWidget::slotStateChanged()
diff --git a/noncore/settings/mediummount/mediumwidget.h b/noncore/settings/mediummount/mediumwidget.h
index 0f27117..28ae369 100644
--- a/noncore/settings/mediummount/mediumwidget.h
+++ b/noncore/settings/mediummount/mediumwidget.h
@@ -20,2 +20,3 @@ class QHBox;
class QLineEdit;
+class QComboBox;
@@ -34,2 +35,3 @@ namespace MediumMountSetting {
void slotAdd();
+ void slotRemove();
void slotStateChanged();
@@ -53,4 +55,5 @@ namespace MediumMountSetting {
- QLineEdit *m_edit;
QPushButton *m_add;
+ QComboBox *m_subList;
+ QPushButton *m_del;