diff options
Diffstat (limited to 'kcontrol/konq')
-rw-r--r-- | kcontrol/konq/desktopbehavior.ui | 10 | ||||
-rw-r--r-- | kcontrol/konq/desktopbehavior_impl.cpp | 40 | ||||
-rw-r--r-- | kcontrol/konq/desktopbehavior_impl.h | 2 |
3 files changed, 32 insertions, 20 deletions
diff --git a/kcontrol/konq/desktopbehavior.ui b/kcontrol/konq/desktopbehavior.ui index 1632021ef..6e614b022 100644 --- a/kcontrol/konq/desktopbehavior.ui +++ b/kcontrol/konq/desktopbehavior.ui @@ -389,7 +389,7 @@ <cstring>mediaListView</cstring> </property> <property name="enabled"> - <bool>false</bool> + <bool>true</bool> </property> <property name="fullWidth"> <bool>true</bool> @@ -403,14 +403,6 @@ </widget> </vbox> </widget> -<connections> - <connection> - <sender>enableMediaBox</sender> - <signal>toggled(bool)</signal> - <receiver>mediaListView</receiver> - <slot>setEnabled(bool)</slot> - </connection> -</connections> <tabstops> <tabstop>autoLineupIconsBox</tabstop> <tabstop>showHiddenBox</tabstop> diff --git a/kcontrol/konq/desktopbehavior_impl.cpp b/kcontrol/konq/desktopbehavior_impl.cpp index 7a7f50a76..9b2da7cf7 100644 --- a/kcontrol/konq/desktopbehavior_impl.cpp +++ b/kcontrol/konq/desktopbehavior_impl.cpp @@ -132,6 +132,7 @@ DesktopBehavior::DesktopBehavior(KConfig *config, TQWidget *parent, const char * connect(vrootBox, TQT_SIGNAL(clicked()), this, TQT_SIGNAL(changed())); connect(autoLineupIconsBox, TQT_SIGNAL(clicked()), this, TQT_SIGNAL(changed())); connect(toolTipBox, TQT_SIGNAL(clicked()), this, TQT_SIGNAL(changed())); + connect(mediaListView, TQT_SIGNAL(clicked(TQListViewItem *)), this, TQT_SLOT(mediaListViewChanged(TQListViewItem *))); strMouseButton1 = i18n("&Left button:"); strButtonTxt1 = i18n( "You can choose what happens when" @@ -228,6 +229,24 @@ DesktopBehavior::DesktopBehavior(KConfig *config, TQWidget *parent, const char * load(); } +void DesktopBehavior::mediaListViewChanged(TQListViewItem * item) +{ + // FIXME: This should check to make sure an item was actually checked/unchecked before emitting changed() + emit changed(); +} + +void DesktopBehavior::setMediaListViewEnabled(bool enabled) +{ + for (DesktopBehaviorMediaItem *it=static_cast<DesktopBehaviorMediaItem *>(mediaListView->firstChild()); + it; it=static_cast<DesktopBehaviorMediaItem *>(it->nextSibling())) + { + if (it->mimeType().startsWith("media/builtin-") == false) + it->setVisible(enabled); + else + it->setVisible(TRUE); + } +} + void DesktopBehavior::fillMediaListView() { mediaListView->clear(); @@ -238,11 +257,10 @@ void DesktopBehavior::fillMediaListView() enableMediaBox->setChecked(g_pConfig->readBoolEntry("enabled",false)); TQString excludedMedia=g_pConfig->readEntry("exclude","media/hdd_mounted,media/hdd_unmounted,media/floppy_unmounted,media/cdrom_unmounted,media/floppy5_unmounted"); for (; it2 != mimetypes.end(); ++it2) { - if ( ((*it2)->name().startsWith("media/")) ) - { - bool ok=excludedMedia.contains((*it2)->name())==0; - new DesktopBehaviorMediaItem (this, mediaListView, (*it2)->comment(), (*it2)->name(),ok); - + if ( ((*it2)->name().startsWith("media/")) ) + { + bool ok=excludedMedia.contains((*it2)->name())==0; + new DesktopBehaviorMediaItem (this, mediaListView, (*it2)->comment(), (*it2)->name(),ok); } } } @@ -256,11 +274,11 @@ void DesktopBehavior::saveMediaListView() g_pConfig->writeEntry("enabled",enableMediaBox->isChecked()); TQStringList exclude; for (DesktopBehaviorMediaItem *it=static_cast<DesktopBehaviorMediaItem *>(mediaListView->firstChild()); - it; it=static_cast<DesktopBehaviorMediaItem *>(it->nextSibling())) - { - if (!it->isOn()) exclude << it->mimeType(); - } - g_pConfig->writeEntry("exclude",exclude); + it; it=static_cast<DesktopBehaviorMediaItem *>(it->nextSibling())) + { + if (!it->isOn()) exclude << it->mimeType(); + } + g_pConfig->writeEntry("exclude",exclude); } @@ -405,7 +423,7 @@ void DesktopBehavior::enableChanged() { behaviorTab->setTabEnabled(behaviorTab->page(2), enabled); enableMediaBox->setEnabled(enabled); - mediaListView->setEnabled(enableMediaBox->isChecked()); + setMediaListViewEnabled(enableMediaBox->isChecked()); } changed(); diff --git a/kcontrol/konq/desktopbehavior_impl.h b/kcontrol/konq/desktopbehavior_impl.h index 851df09f2..e7e181e4d 100644 --- a/kcontrol/konq/desktopbehavior_impl.h +++ b/kcontrol/konq/desktopbehavior_impl.h @@ -45,12 +45,14 @@ private slots: void enableChanged(); void comboBoxChanged(); void editButtonPressed(); + void mediaListViewChanged(TQListViewItem * item); private: KConfig *g_pConfig; void fillMediaListView(); void saveMediaListView(); + void setMediaListViewEnabled(bool enabled); // Combo for the menus void fillMenuCombo( TQComboBox * combo ); |