-rw-r--r-- | noncore/settings/mediummount/mainwindow.cc | 2 | ||||
-rw-r--r-- | noncore/settings/mediummount/mainwindow.h | 2 | ||||
-rw-r--r-- | noncore/settings/mediummount/mediumwidget.cc | 11 |
3 files changed, 5 insertions, 10 deletions
diff --git a/noncore/settings/mediummount/mainwindow.cc b/noncore/settings/mediummount/mainwindow.cc index eec786c..ebe1c94 100644 --- a/noncore/settings/mediummount/mainwindow.cc +++ b/noncore/settings/mediummount/mainwindow.cc | |||
@@ -1,83 +1,83 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <qtabwidget.h> | 3 | #include <qtabwidget.h> |
4 | #include <qlayout.h> | 4 | #include <qlayout.h> |
5 | #include <qtooltip.h> | 5 | #include <qtooltip.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | 7 | ||
8 | #include <qpe/storage.h> | 8 | #include <qpe/storage.h> |
9 | 9 | ||
10 | #include "mediumwidget.h" | 10 | #include "mediumwidget.h" |
11 | #include "mediumglobal.h" | 11 | #include "mediumglobal.h" |
12 | 12 | ||
13 | #include "mainwindow.h" | 13 | #include "mainwindow.h" |
14 | 14 | ||
15 | using namespace MediumMountSetting; | 15 | using namespace MediumMountSetting; |
16 | 16 | ||
17 | /* TRANSLATOR MediumMountSetting::MainWindow */ | 17 | /* TRANSLATOR MediumMountSetting::MainWindow */ |
18 | 18 | ||
19 | MainWindow::MainWindow( QWidget *parent, const char *name, bool modal, WFlags ) | 19 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags, bool modal ) |
20 | : QDialog( parent, name, modal, WStyle_ContextHelp ) | 20 | : QDialog( parent, name, modal, WStyle_ContextHelp ) |
21 | 21 | ||
22 | { | 22 | { |
23 | setCaption ( tr( "Medium Mount Settings" )); | 23 | setCaption ( tr( "Medium Mount Settings" )); |
24 | 24 | ||
25 | m_lay = new QVBoxLayout( this ); | 25 | m_lay = new QVBoxLayout( this ); |
26 | 26 | ||
27 | m_tab = new QTabWidget( this ); | 27 | m_tab = new QTabWidget( this ); |
28 | 28 | ||
29 | m_lay->addWidget( m_tab ); | 29 | m_lay->addWidget( m_tab ); |
30 | 30 | ||
31 | init(); | 31 | init(); |
32 | } | 32 | } |
33 | 33 | ||
34 | MainWindow::~MainWindow() | 34 | MainWindow::~MainWindow() |
35 | { | 35 | { |
36 | } | 36 | } |
37 | 37 | ||
38 | void MainWindow::init() | 38 | void MainWindow::init() |
39 | { | 39 | { |
40 | m_global = new MediumGlobalWidget( m_tab, "test drive" ); | 40 | m_global = new MediumGlobalWidget( m_tab, "test drive" ); |
41 | m_tab->addTab( m_global, tr("Global") ); | 41 | m_tab->addTab( m_global, tr("Global") ); |
42 | 42 | ||
43 | StorageInfo storage; | 43 | StorageInfo storage; |
44 | const QList<FileSystem> &fs = storage.fileSystems(); | 44 | const QList<FileSystem> &fs = storage.fileSystems(); |
45 | QListIterator<FileSystem> it( fs ); | 45 | QListIterator<FileSystem> it( fs ); |
46 | MediumMountWidget *wid; | 46 | MediumMountWidget *wid; |
47 | for( ; it.current(); ++it ){ | 47 | for( ; it.current(); ++it ){ |
48 | if( (*it)->isRemovable() ){ | 48 | if( (*it)->isRemovable() ){ |
49 | wid = new MediumMountWidget((*it)->path(), QPixmap(), m_tab ); | 49 | wid = new MediumMountWidget((*it)->path(), QPixmap(), m_tab ); |
50 | m_mediums.append( wid ); | 50 | m_mediums.append( wid ); |
51 | m_tab->addTab( wid, (*it)->name() ); | 51 | m_tab->addTab( wid, (*it)->name() ); |
52 | } | 52 | } |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | void MainWindow::accept() | 56 | void MainWindow::accept() |
57 | { | 57 | { |
58 | m_global->writeConfig(); | 58 | m_global->writeConfig(); |
59 | 59 | ||
60 | MediumMountWidget *confWidget; | 60 | MediumMountWidget *confWidget; |
61 | for ( confWidget = m_mediums.first(); confWidget != 0; | 61 | for ( confWidget = m_mediums.first(); confWidget != 0; |
62 | confWidget = m_mediums.next() ) { | 62 | confWidget = m_mediums.next() ) { |
63 | confWidget->writeConfig(); | 63 | confWidget->writeConfig(); |
64 | } | 64 | } |
65 | 65 | ||
66 | QDialog::accept(); | 66 | QDialog::accept(); |
67 | } | 67 | } |
68 | 68 | ||
69 | void MainWindow::done ( int r ) | 69 | void MainWindow::done ( int r ) |
70 | { | 70 | { |
71 | QDialog::done( r ); | 71 | QDialog::done( r ); |
72 | close (); | 72 | close (); |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | void MainWindow::slotGlobalChanged(int ) | 76 | void MainWindow::slotGlobalChanged(int ) |
77 | { | 77 | { |
78 | 78 | ||
79 | } | 79 | } |
80 | void MainWindow::slotCheckingChanged(int ) | 80 | void MainWindow::slotCheckingChanged(int ) |
81 | { | 81 | { |
82 | 82 | ||
83 | } | 83 | } |
diff --git a/noncore/settings/mediummount/mainwindow.h b/noncore/settings/mediummount/mainwindow.h index 9649863..7bcb7f5 100644 --- a/noncore/settings/mediummount/mainwindow.h +++ b/noncore/settings/mediummount/mainwindow.h | |||
@@ -1,36 +1,36 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #ifndef MediumMountMainwindow_h | 3 | #ifndef MediumMountMainwindow_h |
4 | #define MediumMountMainwindow_h | 4 | #define MediumMountMainwindow_h |
5 | 5 | ||
6 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | #include <qdialog.h> | 7 | #include <qdialog.h> |
8 | 8 | ||
9 | class QVBoxLayout; | 9 | class QVBoxLayout; |
10 | class QTabWidget; | 10 | class QTabWidget; |
11 | 11 | ||
12 | namespace MediumMountSetting { | 12 | namespace MediumMountSetting { |
13 | class MediumMountWidget; | 13 | class MediumMountWidget; |
14 | class MediumGlobalWidget; | 14 | class MediumGlobalWidget; |
15 | class MainWindow : public QDialog { | 15 | class MainWindow : public QDialog { |
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | public: | 17 | public: |
18 | MainWindow(QWidget *parent = 0, const char *name = 0 , bool modal = FALSE, WFlags = 0); | 18 | MainWindow(QWidget *parent = 0, const char *name = 0 , WFlags = 0, bool modal=true); |
19 | ~MainWindow(); | 19 | ~MainWindow(); |
20 | static QString appName() { return QString::fromLatin1("mediummount"); } | 20 | static QString appName() { return QString::fromLatin1("mediummount"); } |
21 | 21 | ||
22 | private slots: | 22 | private slots: |
23 | void slotGlobalChanged(int ); | 23 | void slotGlobalChanged(int ); |
24 | void slotCheckingChanged(int ); | 24 | void slotCheckingChanged(int ); |
25 | void accept(); | 25 | void accept(); |
26 | void done( int ); | 26 | void done( int ); |
27 | private: | 27 | private: |
28 | void init(); | 28 | void init(); |
29 | QTabWidget *m_tab; | 29 | QTabWidget *m_tab; |
30 | QVBoxLayout *m_lay; | 30 | QVBoxLayout *m_lay; |
31 | MediumGlobalWidget *m_global; | 31 | MediumGlobalWidget *m_global; |
32 | QList<MediumMountWidget> m_mediums; | 32 | QList<MediumMountWidget> m_mediums; |
33 | }; | 33 | }; |
34 | }; | 34 | }; |
35 | 35 | ||
36 | #endif | 36 | #endif |
diff --git a/noncore/settings/mediummount/mediumwidget.cc b/noncore/settings/mediummount/mediumwidget.cc index f39a6ed..ec5b9d5 100644 --- a/noncore/settings/mediummount/mediumwidget.cc +++ b/noncore/settings/mediummount/mediumwidget.cc | |||
@@ -1,250 +1,245 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qgroupbox.h> | 4 | #include <qgroupbox.h> |
5 | #include <qhbox.h> | 5 | #include <qhbox.h> |
6 | #include <qlabel.h> | 6 | #include <qlabel.h> |
7 | #include <qabstractlayout.h> | 7 | #include <qabstractlayout.h> |
8 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qpixmap.h> | 10 | #include <qpixmap.h> |
11 | #include <qpushbutton.h> | 11 | #include <qpushbutton.h> |
12 | #include <qvbox.h> | 12 | #include <qvbox.h> |
13 | #include <qwhatsthis.h> | 13 | #include <qwhatsthis.h> |
14 | #include <qcombobox.h> | 14 | #include <qcombobox.h> |
15 | 15 | ||
16 | 16 | ||
17 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
19 | 19 | ||
20 | #include "mediumwidget.h" | 20 | #include "mediumwidget.h" |
21 | 21 | ||
22 | 22 | ||
23 | 23 | ||
24 | using namespace MediumMountSetting; | 24 | using namespace MediumMountSetting; |
25 | 25 | ||
26 | /* TRANSLATOR MediumMountSetting::MediumMountWidget */ | 26 | /* TRANSLATOR MediumMountSetting::MediumMountWidget */ |
27 | 27 | ||
28 | MediumMountWidget::MediumMountWidget(const QString &path, | 28 | MediumMountWidget::MediumMountWidget(const QString &path, |
29 | const QPixmap &pix, | 29 | const QPixmap &pix, |
30 | QWidget *parent, | 30 | QWidget *parent, |
31 | const char *name ) | 31 | const char *name ) |
32 | : QWidget( parent, name ) | 32 | : QWidget( parent, name ) |
33 | { | 33 | { |
34 | if(parent == 0){ | ||
35 | resize(QApplication::desktop()->width(), QApplication::desktop()->height() ); | ||
36 | }else{ | ||
37 | resize(parent->width(), parent->height() ); | ||
38 | } | ||
39 | m_path = path; | 34 | m_path = path; |
40 | initGUI(); | 35 | initGUI(); |
41 | m_label->setPixmap(pix ); | 36 | m_label->setPixmap(pix ); |
42 | m_config = 0; | 37 | m_config = 0; |
43 | 38 | ||
44 | readConfig(); | 39 | readConfig(); |
45 | } | 40 | } |
46 | // now we fire up the GUI | 41 | // now we fire up the GUI |
47 | // if I would know what I'm doing ;) | 42 | // if I would know what I'm doing ;) |
48 | void MediumMountWidget::initGUI() | 43 | void MediumMountWidget::initGUI() |
49 | { | 44 | { |
50 | //main layout | 45 | //main layout |
51 | m_box = new QVBoxLayout( this , 5, 5 ); | 46 | m_box = new QVBoxLayout( this , 5, 5 ); |
52 | //m_box->setSpacing( 5 ); | 47 | //m_box->setSpacing( 5 ); |
53 | //m_box->addStretch( -1 ); | 48 | //m_box->addStretch( -1 ); |
54 | 49 | ||
55 | // picture + text | 50 | // picture + text |
56 | m_infoBox = new QHBox(this, "infobox" ); | 51 | m_infoBox = new QHBox(this, "infobox" ); |
57 | //m_infoBox->setSpacing( 4 ); | 52 | //m_infoBox->setSpacing( 4 ); |
58 | m_label = new QLabel(m_infoBox ); | 53 | m_label = new QLabel(m_infoBox ); |
59 | m_desc = new QLabel(m_infoBox ); | 54 | m_desc = new QLabel(m_infoBox ); |
60 | m_desc->setTextFormat( Qt::RichText ); | 55 | m_desc->setTextFormat( Qt::RichText ); |
61 | QWhatsThis::add( this, tr("Configure this medium. The changes will" | 56 | QWhatsThis::add( this, tr("Configure this medium. The changes will" |
62 | " go into effect when the application gets" | 57 | " go into effect when the application gets" |
63 | " closed. To update the Document Tab you need" | 58 | " closed. To update the Document Tab you need" |
64 | " to remove and insert this medium.")); | 59 | " to remove and insert this medium.")); |
65 | m_desc->setText("" ); | 60 | m_desc->setText("" ); |
66 | m_box->addWidget( m_infoBox ); // add the widget to the layout | 61 | m_box->addWidget( m_infoBox ); // add the widget to the layout |
67 | 62 | ||
68 | 63 | ||
69 | // groupbox | 64 | // groupbox |
70 | m_group = new QGroupBox(tr("Which media files"), this, "MediaFiles" ); | 65 | m_group = new QGroupBox(tr("Which media files"), this, "MediaFiles" ); |
71 | m_checks = new QGridLayout( m_group, 4, 3 ); | 66 | m_checks = new QGridLayout( m_group, 4, 3 ); |
72 | //m_checks->setMargin( 12 ); | 67 | //m_checks->setMargin( 12 ); |
73 | 68 | ||
74 | 69 | ||
75 | 70 | ||
76 | QSpacerItem *item2 = new QSpacerItem(5, 8, | 71 | QSpacerItem *item2 = new QSpacerItem(5, 8, |
77 | QSizePolicy::Fixed, | 72 | QSizePolicy::Fixed, |
78 | QSizePolicy::Fixed); | 73 | QSizePolicy::Fixed); |
79 | m_box->addItem( item2 ); | 74 | m_box->addItem( item2 ); |
80 | 75 | ||
81 | m_audio = new QCheckBox( tr("Audio"), m_group ); | 76 | m_audio = new QCheckBox( tr("Audio"), m_group ); |
82 | m_all = new QCheckBox( tr("All") , m_group ); | 77 | m_all = new QCheckBox( tr("All") , m_group ); |
83 | m_image = new QCheckBox( tr("Image"), m_group ); | 78 | m_image = new QCheckBox( tr("Image"), m_group ); |
84 | m_text = new QCheckBox( tr("Text") , m_group ); | 79 | m_text = new QCheckBox( tr("Text") , m_group ); |
85 | m_video = new QCheckBox( tr("Video"), m_group ); | 80 | m_video = new QCheckBox( tr("Video"), m_group ); |
86 | 81 | ||
87 | QSpacerItem *iti1b = new QSpacerItem(2, 10, QSizePolicy::Fixed, | 82 | QSpacerItem *iti1b = new QSpacerItem(2, 10, QSizePolicy::Fixed, |
88 | QSizePolicy::Fixed ); | 83 | QSizePolicy::Fixed ); |
89 | m_checks->addItem( iti1b, 0, 0 ); | 84 | m_checks->addItem( iti1b, 0, 0 ); |
90 | 85 | ||
91 | m_checks->addWidget(m_audio, 1, 0 ); | 86 | m_checks->addWidget(m_audio, 1, 0 ); |
92 | m_checks->addWidget(m_image, 2, 0 ); | 87 | m_checks->addWidget(m_image, 2, 0 ); |
93 | m_checks->addWidget(m_all , 3, 0 ); | 88 | m_checks->addWidget(m_all , 3, 0 ); |
94 | 89 | ||
95 | m_checks->addWidget(m_text, 1, 2 ); | 90 | m_checks->addWidget(m_text, 1, 2 ); |
96 | m_checks->addWidget(m_video, 2, 2 ); | 91 | m_checks->addWidget(m_video, 2, 2 ); |
97 | 92 | ||
98 | m_checks->addRowSpacing(0, 8 ); | 93 | m_checks->addRowSpacing(0, 8 ); |
99 | m_checks->addColSpacing(1, 2 ); | 94 | m_checks->addColSpacing(1, 2 ); |
100 | m_checks->setColStretch(1, -2 ); | 95 | m_checks->setColStretch(1, -2 ); |
101 | 96 | ||
102 | connect(m_all, SIGNAL(stateChanged(int) ), | 97 | connect(m_all, SIGNAL(stateChanged(int) ), |
103 | this, SLOT(slotStateChanged() ) ); | 98 | this, SLOT(slotStateChanged() ) ); |
104 | 99 | ||
105 | m_box->addWidget( m_group ); | 100 | m_box->addWidget( m_group ); |
106 | 101 | ||
107 | // label | 102 | // label |
108 | m_lblPath = new QLabel(tr("Limit search to:"), this ); | 103 | m_lblPath = new QLabel(tr("Limit search to:"), this ); |
109 | m_box->addWidget( m_lblPath ); | 104 | m_box->addWidget( m_lblPath ); |
110 | 105 | ||
111 | 106 | ||
112 | m_subList = new QComboBox(FALSE,this,"docFolderList"); | 107 | m_subList = new QComboBox(FALSE,this,"docFolderList"); |
113 | m_subList->setDuplicatesEnabled(FALSE); | 108 | m_subList->setDuplicatesEnabled(FALSE); |
114 | m_subList->setEditable(TRUE); | 109 | m_subList->setEditable(TRUE); |
115 | m_box->addWidget(m_subList); | 110 | m_box->addWidget(m_subList); |
116 | 111 | ||
117 | m_hboxAdd = new QHBox( this ); | 112 | m_hboxAdd = new QHBox( this ); |
118 | m_add = new QPushButton(m_hboxAdd ); | 113 | m_add = new QPushButton(m_hboxAdd ); |
119 | m_add->setText( tr("Add") ); | 114 | m_add->setText( tr("Add") ); |
120 | m_del = new QPushButton(m_hboxAdd); | 115 | m_del = new QPushButton(m_hboxAdd); |
121 | m_del->setText(tr("Remove")); | 116 | m_del->setText(tr("Remove")); |
122 | 117 | ||
123 | connect(m_add, SIGNAL(clicked() ), | 118 | connect(m_add, SIGNAL(clicked() ), |
124 | this, SLOT(slotAdd() ) ); | 119 | this, SLOT(slotAdd() ) ); |
125 | connect(m_del, SIGNAL(clicked() ), | 120 | connect(m_del, SIGNAL(clicked() ), |
126 | this, SLOT(slotRemove() ) ); | 121 | this, SLOT(slotRemove() ) ); |
127 | 122 | ||
128 | m_box->addWidget(m_hboxAdd ); | 123 | m_box->addWidget(m_hboxAdd ); |
129 | m_scan_all_check = new QCheckBox( tr("Scan whole media"), this ); | 124 | m_scan_all_check = new QCheckBox( tr("Scan whole media"), this ); |
130 | connect(m_scan_all_check,SIGNAL(stateChanged(int)),this,SLOT(slotScanAllChanged(int))); | 125 | connect(m_scan_all_check,SIGNAL(stateChanged(int)),this,SLOT(slotScanAllChanged(int))); |
131 | 126 | ||
132 | m_box->addWidget(m_scan_all_check); | 127 | m_box->addWidget(m_scan_all_check); |
133 | 128 | ||
134 | m_always = new QCheckBox( tr("Always check this medium"), this ); | 129 | m_always = new QCheckBox( tr("Always check this medium"), this ); |
135 | 130 | ||
136 | m_box->addWidget( m_always ); | 131 | m_box->addWidget( m_always ); |
137 | 132 | ||
138 | QSpacerItem *item = new QSpacerItem(5, 50, | 133 | QSpacerItem *item = new QSpacerItem(5, 50, |
139 | QSizePolicy::Fixed, | 134 | QSizePolicy::Fixed, |
140 | QSizePolicy::Expanding ); | 135 | QSizePolicy::Expanding ); |
141 | m_box->addItem(item ); | 136 | m_box->addItem(item ); |
142 | } | 137 | } |
143 | 138 | ||
144 | void MediumMountWidget::readConfig( ) | 139 | void MediumMountWidget::readConfig( ) |
145 | { | 140 | { |
146 | if( m_config == 0 ) | 141 | if( m_config == 0 ) |
147 | m_config = new Config(m_path + "/.opiestorage.cf", Config::File ); | 142 | m_config = new Config(m_path + "/.opiestorage.cf", Config::File ); |
148 | m_config->setGroup( "main" ); | 143 | m_config->setGroup( "main" ); |
149 | 144 | ||
150 | m_always->setChecked( m_config->readBoolEntry("check", false) ); | 145 | m_always->setChecked( m_config->readBoolEntry("check", false) ); |
151 | 146 | ||
152 | m_config->setGroup( "mimetypes" ); | 147 | m_config->setGroup( "mimetypes" ); |
153 | if( m_config->readBoolEntry("all", false ) ){ | 148 | if( m_config->readBoolEntry("all", false ) ){ |
154 | m_audio->setEnabled( false ); | 149 | m_audio->setEnabled( false ); |
155 | m_image->setEnabled( false ); | 150 | m_image->setEnabled( false ); |
156 | m_text->setEnabled ( false ); | 151 | m_text->setEnabled ( false ); |
157 | m_video->setEnabled( false ); | 152 | m_video->setEnabled( false ); |
158 | m_all->setChecked( true ); | 153 | m_all->setChecked( true ); |
159 | }else{ | 154 | }else{ |
160 | m_audio->setEnabled( true ); | 155 | m_audio->setEnabled( true ); |
161 | m_image->setEnabled( true ); | 156 | m_image->setEnabled( true ); |
162 | m_text->setEnabled ( true ); | 157 | m_text->setEnabled ( true ); |
163 | m_all->setEnabled ( true ); | 158 | m_all->setEnabled ( true ); |
164 | 159 | ||
165 | m_all->setChecked( false ); | 160 | m_all->setChecked( false ); |
166 | 161 | ||
167 | m_audio->setChecked( m_config->readBoolEntry("audio", true ) ); | 162 | m_audio->setChecked( m_config->readBoolEntry("audio", true ) ); |
168 | m_image->setChecked( m_config->readBoolEntry("image", true ) ); | 163 | m_image->setChecked( m_config->readBoolEntry("image", true ) ); |
169 | m_text->setChecked ( m_config->readBoolEntry("text" , true ) ); | 164 | m_text->setChecked ( m_config->readBoolEntry("text" , true ) ); |
170 | m_video->setChecked( m_config->readBoolEntry("video", true ) ); | 165 | m_video->setChecked( m_config->readBoolEntry("video", true ) ); |
171 | }; | 166 | }; |
172 | m_config->setGroup("subdirs"); | 167 | m_config->setGroup("subdirs"); |
173 | QStringList entries = m_config->readListEntry("subdirs",':'); | 168 | QStringList entries = m_config->readListEntry("subdirs",':'); |
174 | m_subList->clear(); | 169 | m_subList->clear(); |
175 | m_subList->insertStringList(entries); | 170 | m_subList->insertStringList(entries); |
176 | m_scan_all_check->setChecked(m_config->readBoolEntry("wholemedia",true)); | 171 | m_scan_all_check->setChecked(m_config->readBoolEntry("wholemedia",true)); |
177 | } | 172 | } |
178 | 173 | ||
179 | void MediumMountWidget::writeConfig() | 174 | void MediumMountWidget::writeConfig() |
180 | { | 175 | { |
181 | m_config->setGroup("main"); | 176 | m_config->setGroup("main"); |
182 | m_config->writeEntry("check", m_always->isChecked() ); | 177 | m_config->writeEntry("check", m_always->isChecked() ); |
183 | 178 | ||
184 | m_config->setGroup("mimetypes" ); | 179 | m_config->setGroup("mimetypes" ); |
185 | if(m_all->isChecked() ){ | 180 | if(m_all->isChecked() ){ |
186 | m_config->writeEntry("all", true ); | 181 | m_config->writeEntry("all", true ); |
187 | }else{ | 182 | }else{ |
188 | m_config->writeEntry("audio", m_audio->isChecked() ); | 183 | m_config->writeEntry("audio", m_audio->isChecked() ); |
189 | m_config->writeEntry("image", m_image->isChecked() ); | 184 | m_config->writeEntry("image", m_image->isChecked() ); |
190 | m_config->writeEntry("text" , m_text->isChecked() ); | 185 | m_config->writeEntry("text" , m_text->isChecked() ); |
191 | m_config->writeEntry("video", m_video->isChecked() ); | 186 | m_config->writeEntry("video", m_video->isChecked() ); |
192 | } | 187 | } |
193 | m_config->setGroup("subdirs"); | 188 | m_config->setGroup("subdirs"); |
194 | QStringList entries; | 189 | QStringList entries; |
195 | QString ctext; | 190 | QString ctext; |
196 | for (int i = 0; i < m_subList->count();++i) { | 191 | for (int i = 0; i < m_subList->count();++i) { |
197 | ctext = m_subList->text(i); | 192 | ctext = m_subList->text(i); |
198 | if (ctext.isEmpty()) | 193 | if (ctext.isEmpty()) |
199 | continue; | 194 | continue; |
200 | if (ctext.startsWith("/")) { | 195 | if (ctext.startsWith("/")) { |
201 | ctext = ctext.right(ctext.length()-1); | 196 | ctext = ctext.right(ctext.length()-1); |
202 | } | 197 | } |
203 | if (!ctext.isEmpty()) { | 198 | if (!ctext.isEmpty()) { |
204 | entries.append(ctext); | 199 | entries.append(ctext); |
205 | } | 200 | } |
206 | } | 201 | } |
207 | m_config->writeEntry("subdirs",entries,':'); | 202 | m_config->writeEntry("subdirs",entries,':'); |
208 | m_config->writeEntry("wholemedia",m_scan_all_check->isChecked()); | 203 | m_config->writeEntry("wholemedia",m_scan_all_check->isChecked()); |
209 | } | 204 | } |
210 | 205 | ||
211 | MediumMountWidget::~MediumMountWidget() | 206 | MediumMountWidget::~MediumMountWidget() |
212 | { | 207 | { |
213 | delete m_config; | 208 | delete m_config; |
214 | } | 209 | } |
215 | 210 | ||
216 | void MediumMountWidget::slotAdd() | 211 | void MediumMountWidget::slotAdd() |
217 | { | 212 | { |
218 | if (m_subList->currentText()==m_subList->text(m_subList->currentItem())) | 213 | if (m_subList->currentText()==m_subList->text(m_subList->currentItem())) |
219 | return; | 214 | return; |
220 | m_subList->insertItem(m_subList->currentText()); | 215 | m_subList->insertItem(m_subList->currentText()); |
221 | } | 216 | } |
222 | 217 | ||
223 | void MediumMountWidget::slotRemove() | 218 | void MediumMountWidget::slotRemove() |
224 | { | 219 | { |
225 | QString text = m_subList->currentText(); | 220 | QString text = m_subList->currentText(); |
226 | if (text != m_subList->text(m_subList->currentItem())) { | 221 | if (text != m_subList->text(m_subList->currentItem())) { |
227 | m_subList->clearEdit (); | 222 | m_subList->clearEdit (); |
228 | } else { | 223 | } else { |
229 | m_subList->removeItem(m_subList->currentItem()); | 224 | m_subList->removeItem(m_subList->currentItem()); |
230 | } | 225 | } |
231 | } | 226 | } |
232 | 227 | ||
233 | void MediumMountWidget::slotStateChanged() | 228 | void MediumMountWidget::slotStateChanged() |
234 | { | 229 | { |
235 | bool state = !(m_all->isChecked()); | 230 | bool state = !(m_all->isChecked()); |
236 | 231 | ||
237 | m_audio->setEnabled( state ); | 232 | m_audio->setEnabled( state ); |
238 | m_text->setEnabled ( state ); | 233 | m_text->setEnabled ( state ); |
239 | m_video->setEnabled( state ); | 234 | m_video->setEnabled( state ); |
240 | m_image->setEnabled( state ); | 235 | m_image->setEnabled( state ); |
241 | 236 | ||
242 | } | 237 | } |
243 | 238 | ||
244 | void MediumMountWidget::slotScanAllChanged(int) | 239 | void MediumMountWidget::slotScanAllChanged(int) |
245 | { | 240 | { |
246 | bool state = !(m_scan_all_check->isChecked()); | 241 | bool state = !(m_scan_all_check->isChecked()); |
247 | m_add->setEnabled(state); | 242 | m_add->setEnabled(state); |
248 | m_del->setEnabled(state); | 243 | m_del->setEnabled(state); |
249 | m_subList->setEnabled(state); | 244 | m_subList->setEnabled(state); |
250 | } | 245 | } |