diff options
Diffstat (limited to 'kcontrol/konq/desktopbehavior_impl.cpp')
-rw-r--r-- | kcontrol/konq/desktopbehavior_impl.cpp | 78 |
1 files changed, 59 insertions, 19 deletions
diff --git a/kcontrol/konq/desktopbehavior_impl.cpp b/kcontrol/konq/desktopbehavior_impl.cpp index 17fc2f364..3d149ef39 100644 --- a/kcontrol/konq/desktopbehavior_impl.cpp +++ b/kcontrol/konq/desktopbehavior_impl.cpp @@ -28,6 +28,7 @@ #include <tqcombobox.h> #include <tqpushbutton.h> #include <tqbuttongroup.h> +#include <tqspinbox.h> #include <tqtabwidget.h> #include <tqwhatsthis.h> #include <tdelistview.h> @@ -52,7 +53,7 @@ DesktopBehaviorModule::DesktopBehaviorModule(TDEConfig *config, TQWidget *parent TQVBoxLayout* layout = new TQVBoxLayout(this); m_behavior = new DesktopBehavior(config, this); layout->addWidget(m_behavior); - connect(m_behavior, TQT_SIGNAL(changed()), this, TQT_SLOT(changed())); + connect(m_behavior, TQ_SIGNAL(changed()), this, TQ_SLOT(changed())); } void DesktopBehaviorModule::changed() @@ -126,13 +127,16 @@ DesktopBehavior::DesktopBehavior(TDEConfig *config, TQWidget *parent, const char m_bHasMedia = KProtocolInfo::isKnownProtocol(TQString::fromLatin1("media")); - connect(desktopMenuGroup, TQT_SIGNAL(clicked(int)), this, TQT_SIGNAL(changed())); - connect(iconsEnabledBox, TQT_SIGNAL(clicked()), this, TQT_SLOT(enableChanged())); - connect(showHiddenBox, TQT_SIGNAL(clicked()), this, TQT_SIGNAL(changed())); - 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 *))); + connect(desktopMenuGroup, TQ_SIGNAL(clicked(int)), this, TQ_SIGNAL(changed())); + connect(iconsEnabledBox, TQ_SIGNAL(clicked()), this, TQ_SLOT(enableChanged())); + connect(showHiddenBox, TQ_SIGNAL(clicked()), this, TQ_SIGNAL(changed())); + connect(vrootBox, TQ_SIGNAL(clicked()), this, TQ_SIGNAL(changed())); + connect(lockInPlaceBox, TQ_SIGNAL(clicked()), this, TQ_SLOT(enableGridChanged())); + connect(autoLineupIconsBox, TQ_SIGNAL(clicked()), this, TQ_SLOT(enableGridChanged())); + connect(toolTipBox, TQ_SIGNAL(clicked()), this, TQ_SIGNAL(changed())); + connect(mediaListView, TQ_SIGNAL(clicked(TQListViewItem *)), this, TQ_SLOT(mediaListViewChanged(TQListViewItem *))); + connect(spacingValue, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(spacingChanged(int))); + connect(spacingCtrlScroll, TQ_SIGNAL(clicked()), this, TQ_SIGNAL(changed())); strMouseButton1 = i18n("&Left button:"); strButtonTxt1 = i18n( "You can choose what happens when" @@ -151,9 +155,9 @@ DesktopBehavior::DesktopBehavior(TDEConfig *config, TQWidget *parent, const char leftLabel->setText( strMouseButton1 ); leftLabel->setBuddy( leftComboBox ); fillMenuCombo( leftComboBox ); - connect(leftEditButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(editButtonPressed())); - connect(leftComboBox, TQT_SIGNAL(activated(int)), this, TQT_SIGNAL(changed())); - connect(leftComboBox, TQT_SIGNAL(activated(int)), this, TQT_SLOT(comboBoxChanged())); + connect(leftEditButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(editButtonPressed())); + connect(leftComboBox, TQ_SIGNAL(activated(int)), this, TQ_SIGNAL(changed())); + connect(leftComboBox, TQ_SIGNAL(activated(int)), this, TQ_SLOT(comboBoxChanged())); TQString wtstr = strButtonTxt1 + i18n(" <ul><li><em>No action:</em> as you might guess, nothing happens!</li>" " <li><em>Window list menu:</em> a menu showing all windows on all" @@ -173,9 +177,9 @@ DesktopBehavior::DesktopBehavior(TDEConfig *config, TQWidget *parent, const char middleLabel->setBuddy( middleComboBox ); fillMenuCombo( middleComboBox ); - connect(middleEditButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(editButtonPressed())); - connect(middleComboBox, TQT_SIGNAL(activated(int)), this, TQT_SIGNAL(changed())); - connect(middleComboBox, TQT_SIGNAL(activated(int)), this, TQT_SLOT(comboBoxChanged())); + connect(middleEditButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(editButtonPressed())); + connect(middleComboBox, TQ_SIGNAL(activated(int)), this, TQ_SIGNAL(changed())); + connect(middleComboBox, TQ_SIGNAL(activated(int)), this, TQ_SLOT(comboBoxChanged())); wtstr = i18n("You can choose what happens when" " you click the middle button of your pointing device on the desktop:" " <ul><li><em>No action:</em> as you might guess, nothing happens!</li>" @@ -197,9 +201,9 @@ DesktopBehavior::DesktopBehavior(TDEConfig *config, TQWidget *parent, const char rightLabel->setText( strMouseButton3 ); rightLabel->setBuddy( rightComboBox ); fillMenuCombo( rightComboBox ); - connect(rightEditButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(editButtonPressed())); - connect(rightComboBox, TQT_SIGNAL(activated(int)), this, TQT_SIGNAL(changed())); - connect(rightComboBox, TQT_SIGNAL(activated(int)), this, TQT_SLOT(comboBoxChanged())); + connect(rightEditButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(editButtonPressed())); + connect(rightComboBox, TQ_SIGNAL(activated(int)), this, TQ_SIGNAL(changed())); + connect(rightComboBox, TQ_SIGNAL(activated(int)), this, TQ_SLOT(comboBoxChanged())); wtstr = strButtonTxt3 + i18n(" <ul><li><em>No action:</em> as you might guess, nothing happens!</li>" " <li><em>Window list menu:</em> a menu showing all windows on all" @@ -219,8 +223,8 @@ DesktopBehavior::DesktopBehavior(TDEConfig *config, TQWidget *parent, const char if (m_bHasMedia) { - connect(enableMediaBox, TQT_SIGNAL(clicked()), this, TQT_SLOT(enableChanged())); - connect(enableMediaFreeSpaceOverlayBox, TQT_SIGNAL(clicked()), this, TQT_SLOT(enableChanged())); + connect(enableMediaBox, TQ_SIGNAL(clicked()), this, TQ_SLOT(enableChanged())); + connect(enableMediaFreeSpaceOverlayBox, TQ_SIGNAL(clicked()), this, TQ_SLOT(enableChanged())); } else { @@ -236,6 +240,11 @@ void DesktopBehavior::mediaListViewChanged(TQListViewItem * item) emit changed(); } +void DesktopBehavior::spacingChanged(int value) +{ + emit changed(); +} + void DesktopBehavior::setMediaListViewEnabled(bool enabled) { for (DesktopBehaviorMediaItem *it=static_cast<DesktopBehaviorMediaItem *>(mediaListView->firstChild()); @@ -307,6 +316,9 @@ void DesktopBehavior::load( bool useDefaults ) g_pConfig->setGroup( "Desktop Icons" ); bool bShowHidden = g_pConfig->readBoolEntry("ShowHidden", DEFAULT_SHOW_HIDDEN_ROOT_ICONS); showHiddenBox->setChecked(bShowHidden); + spacingValue->setValue( g_pConfig->readNumEntry("IconSpacing", 5) ); + spacingCtrlScroll->setChecked( g_pConfig->readBoolEntry("SpacingCtrlScroll", false) ); + lockInPlaceBox->setChecked( g_pConfig->readBoolEntry( "LockIcons", false ) ); //bool bVertAlign = g_pConfig->readBoolEntry("VertAlign", DEFAULT_VERT_ALIGN); TDETrader::OfferList plugins = TDETrader::self()->query("ThumbCreator"); previewListView->clear(); @@ -333,6 +345,8 @@ void DesktopBehavior::load( bool useDefaults ) iconsEnabledBox->setChecked( g_pConfig->readBoolEntry( "Enabled", true ) ); autoLineupIconsBox->setChecked( g_pConfig->readBoolEntry( "AutoLineUpIcons", false ) ); + toggleSpacingOpts(); + // g_pConfig->setGroup( "Mouse Buttons" ); TQString s; @@ -365,6 +379,9 @@ void DesktopBehavior::save() { g_pConfig->setGroup( "Desktop Icons" ); g_pConfig->writeEntry("ShowHidden", showHiddenBox->isChecked()); + g_pConfig->writeEntry("IconSpacing", spacingValue->value()); + g_pConfig->writeEntry("SpacingCtrlScroll", spacingCtrlScroll->isChecked()); + g_pConfig->writeEntry("LockIcons", lockInPlaceBox->isChecked()); TQStringList previews; for ( DesktopBehaviorPreviewItem *item = static_cast<DesktopBehaviorPreviewItem *>( previewListView->firstChild() ); item; @@ -395,6 +412,8 @@ void DesktopBehavior::save() g_pConfig->writeEntry( "Enabled", iconsEnabledBox->isChecked() ); g_pConfig->writeEntry( "AutoLineUpIcons", autoLineupIconsBox->isChecked() ); + toggleSpacingOpts(); + saveMediaListView(); g_pConfig->sync(); @@ -421,6 +440,9 @@ void DesktopBehavior::enableChanged() bool enabled = iconsEnabledBox->isChecked(); behaviorTab->setTabEnabled(behaviorTab->page(1), enabled); vrootBox->setEnabled(enabled); + lockInPlaceBox->setEnabled(enabled); + autoLineupIconsBox->setEnabled(enabled); + enableGridChanged(); if (m_bHasMedia) { @@ -433,6 +455,24 @@ void DesktopBehavior::enableChanged() changed(); } +void DesktopBehavior::toggleSpacingOpts() +{ + bool enabled = ( + autoLineupIconsBox->isEnabled() && // Desktop grid available + autoLineupIconsBox->isChecked() && // Desktop grid enabled + !lockInPlaceBox->isChecked() // Lock in Place is off + ); + + spacingCtrlScroll->setEnabled(enabled); + spacingValue->setEnabled(enabled); +} + +void DesktopBehavior::enableGridChanged() +{ + toggleSpacingOpts(); + changed(); +} + void DesktopBehavior::comboBoxChanged() { int i; |