summaryrefslogtreecommitdiff
Unidiff
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 @@
13#include <qwhatsthis.h> 13#include <qwhatsthis.h>
14#include <qcombobox.h>
14 15
@@ -109,11 +110,21 @@ void MediumMountWidget::initGUI()
109 110
110 // add to 111
112 m_subList = new QComboBox(FALSE,this,"docFolderList");
113 m_subList->setDuplicatesEnabled(FALSE);
114 m_subList->setEditable(TRUE);
115 m_box->addWidget(m_subList);
116
111 m_hboxAdd = new QHBox( this ); 117 m_hboxAdd = new QHBox( this );
112 //m_hboxAdd->setSpacing( 10 );
113 m_edit = new QLineEdit(m_hboxAdd );
114 m_add = new QPushButton(m_hboxAdd ); 118 m_add = new QPushButton(m_hboxAdd );
115 m_add->setText( tr("Add") ); 119 m_add->setText( tr("Add") );
120 m_del = new QPushButton(m_hboxAdd);
121 m_del->setText(tr("Remove"));
122
123 connect(m_add, SIGNAL(clicked() ),
124 this, SLOT(slotAdd() ) );
125 connect(m_del, SIGNAL(clicked() ),
126 this, SLOT(slotRemove() ) );
116 127
117 m_box->addWidget(m_hboxAdd ); 128 m_box->addWidget(m_hboxAdd );
118 129
119 m_always = new QCheckBox( tr("Always check this medium"), this ); 130 m_always = new QCheckBox( tr("Always check this medium"), this );
@@ -156,2 +167,6 @@ void MediumMountWidget::readConfig( )
156 }; 167 };
168 m_config->setGroup("subdirs");
169 QStringList entries = m_config->readListEntry("subdirs",':');
170 m_subList->clear();
171 m_subList->insertStringList(entries);
157} 172}
@@ -172,2 +187,15 @@ void MediumMountWidget::writeConfig()
172 } 187 }
188 m_config->setGroup("subdirs");
189 QStringList entries;
190 QString ctext;
191 for (int i = 0; i < m_subList->count();++i) {
192 ctext = m_subList->text(i);
193 if (ctext.isEmpty())
194 continue;
195 if (ctext.startsWith("/")&&ctext.length()>1) {
196 ctext = ctext.right(ctext.length()-1);
197 }
198 entries.append(ctext);
199 }
200 m_config->writeEntry("subdirs",entries,':');
173} 201}
@@ -180,4 +208,17 @@ void MediumMountWidget::slotAdd()
180{ 208{
209 if (m_subList->currentText()==m_subList->text(m_subList->currentItem()))
210 return;
211 m_subList->insertItem(m_subList->currentText());
212}
181 213
214void MediumMountWidget::slotRemove()
215{
216 QString text = m_subList->currentText();
217 if (text != m_subList->text(m_subList->currentItem())) {
218 m_subList->clearEdit ();
219 } else {
220 m_subList->removeItem(m_subList->currentItem());
221 }
182} 222}
223
183void MediumMountWidget::slotStateChanged() 224void 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;
20class QLineEdit; 20class QLineEdit;
21class QComboBox;
21 22
@@ -34,2 +35,3 @@ namespace MediumMountSetting {
34 void slotAdd(); 35 void slotAdd();
36 void slotRemove();
35 void slotStateChanged(); 37 void slotStateChanged();
@@ -53,4 +55,5 @@ namespace MediumMountSetting {
53 55
54 QLineEdit *m_edit;
55 QPushButton *m_add; 56 QPushButton *m_add;
57 QComboBox *m_subList;
58 QPushButton *m_del;
56 59