summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kcmconfigs
authorulf69 <ulf69>2004-09-02 23:07:29 (UTC)
committer ulf69 <ulf69>2004-09-02 23:07:29 (UTC)
commita2d8fcc8f1fcd64c01e41cb8ba31ae17a5ea5a8b (patch) (unidiff)
tree80ecec37a7aa38ece91ac77409bf9f504e8e009e /kaddressbook/kcmconfigs
parent436f0b8e6b73d7c3db1ac17da5ff245e6b12a18c (diff)
downloadkdepimpi-a2d8fcc8f1fcd64c01e41cb8ba31ae17a5ea5a8b.zip
kdepimpi-a2d8fcc8f1fcd64c01e41cb8ba31ae17a5ea5a8b.tar.gz
kdepimpi-a2d8fcc8f1fcd64c01e41cb8ba31ae17a5ea5a8b.tar.bz2
sourceforge 1014892, quit dialog now configurable
Diffstat (limited to 'kaddressbook/kcmconfigs') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp36
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h1
2 files changed, 26 insertions, 11 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 31ab7b5..3a2ccbb 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -28,12 +28,13 @@
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qtabwidget.h> 29#include <qtabwidget.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qvbox.h>
34 35
35#include <kconfig.h> 36#include <kconfig.h>
36#include <kdebug.h> 37#include <kdebug.h>
37#include <kdialog.h> 38#include <kdialog.h>
38#include <klistview.h> 39#include <klistview.h>
39#include <klocale.h> 40#include <klocale.h>
@@ -95,34 +96,43 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
95 96
96 // General page 97 // General page
97 QWidget *generalPage = new QWidget( this ); 98 QWidget *generalPage = new QWidget( this );
98 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), 99 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
99 KDialog::spacingHintSmall() ); 100 KDialog::spacingHintSmall() );
100 //general groupbox 101 //general groupbox
101 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); 102 QVBox *vBox = new QVBox( generalPage, "qvbox" );
102 QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); 103 QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" );
103 boxLayout->setAlignment( Qt::AlignTop ); 104 boxLayout->setAlignment( Qt::AlignTop );
104 boxLayout->setMargin(KDialog::marginHintSmall() ); 105 boxLayout->setMargin(KDialog::marginHintSmall() );
105 groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; 106 vBox->layout()->setMargin(KDialog::marginHintSmall()) ;
106 groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); 107 vBox->layout()->setSpacing(KDialog::spacingHintSmall());
107 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 108 boxLayout->setSpacing( KDialog::spacingHintSmall() );
108 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" ); 109 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" );
109 boxLayout->addWidget( mViewsSingleClickBox ); 110 boxLayout->addWidget( mViewsSingleClickBox );
110 111
111 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" ); 112 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" );
112 boxLayout->addWidget( mNameParsing ); 113 boxLayout->addWidget( mNameParsing );
113 114
114 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), groupBox, "mdisplay" ); 115 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
115 boxLayout->addWidget( mMultipleViewsAtOnce ); 116 boxLayout->addWidget( mMultipleViewsAtOnce );
116 117
117 layout->addWidget( groupBox ); 118 mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" );
119 boxLayout->addWidget( mAskForQuit );
118 120
121 layout->addWidget( vBox );
122
123 tabWidget->addTab( generalPage, i18n( "General" ) );
124
125 // Extension page
126 QWidget *extensionPage = new QWidget( this );
127 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(),
128 KDialog::spacingHintSmall() );
119 129
120 //extensions groupbox 130 //extensions groupbox
121 131
122 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), generalPage ); 132 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
123 boxLayout = new QVBoxLayout( groupBox->layout() ); 133 boxLayout = new QVBoxLayout( groupBox->layout() );
124 boxLayout->setAlignment( Qt::AlignTop ); 134 boxLayout->setAlignment( Qt::AlignTop );
125 boxLayout->setMargin(KDialog::marginHintSmall()); 135 boxLayout->setMargin(KDialog::marginHintSmall());
126 boxLayout->setSpacing(KDialog::spacingHintSmall()); 136 boxLayout->setSpacing(KDialog::spacingHintSmall());
127 groupBox->layout()->setMargin(1) ; 137 groupBox->layout()->setMargin(1) ;
128 groupBox->layout()->setSpacing(0); 138 groupBox->layout()->setSpacing(0);
@@ -135,25 +145,26 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
135 boxLayout->addWidget( mExtensionView ); 145 boxLayout->addWidget( mExtensionView );
136 146
137 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 147 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
138 mConfigureButton->setEnabled( false ); 148 mConfigureButton->setEnabled( false );
139 boxLayout->addWidget( mConfigureButton ); 149 boxLayout->addWidget( mConfigureButton );
140 150
141 layout->addWidget( groupBox ); 151 extensionLayout->addWidget( groupBox );
142 152
143 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 153 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
144 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 154 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
145 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 155 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
156 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
146 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 157 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
147 SLOT( selectionChanged( QListViewItem* ) ) ); 158 SLOT( selectionChanged( QListViewItem* ) ) );
148 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 159 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
149 SLOT( itemClicked( QListViewItem* ) ) ); 160 SLOT( itemClicked( QListViewItem* ) ) );
150 connect( mConfigureButton, SIGNAL( clicked() ), 161 connect( mConfigureButton, SIGNAL( clicked() ),
151 SLOT( configureExtension() ) ); 162 SLOT( configureExtension() ) );
152 163
153 tabWidget->addTab( generalPage, i18n( "General" ) ); 164 tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
154 165
155 // Addressee page 166 // Addressee page
156 mAddresseeWidget = new AddresseeWidget( this ); 167 mAddresseeWidget = new AddresseeWidget( this );
157 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 168 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
158 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 169 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
159 170
@@ -167,12 +178,13 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs)
167 bool blocked = signalsBlocked(); 178 bool blocked = signalsBlocked();
168 blockSignals( true ); 179 blockSignals( true );
169 180
170 mNameParsing->setChecked( prefs->mAutomaticNameParsing ); 181 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
171 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); 182 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
172 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); 183 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
184 mAskForQuit->setChecked( prefs->mAskForQuit );
173 185
174 mAddresseeWidget->restoreSettings(); 186 mAddresseeWidget->restoreSettings();
175 187
176 restoreExtensionSettings(); 188 restoreExtensionSettings();
177 189
178 blockSignals( blocked ); 190 blockSignals( blocked );
@@ -182,12 +194,13 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs)
182 194
183void KABConfigWidget::saveSettings(KABPrefs* prefs) 195void KABConfigWidget::saveSettings(KABPrefs* prefs)
184{ 196{
185 prefs->mAutomaticNameParsing = mNameParsing->isChecked(); 197 prefs->mAutomaticNameParsing = mNameParsing->isChecked();
186 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 198 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
187 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); 199 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
200 prefs->mAskForQuit = mAskForQuit->isChecked();
188 201
189 mAddresseeWidget->saveSettings(); 202 mAddresseeWidget->saveSettings();
190 203
191 saveExtensionSettings(); 204 saveExtensionSettings();
192 KABPrefs::instance()->writeConfig(); 205 KABPrefs::instance()->writeConfig();
193 206
@@ -196,12 +209,13 @@ void KABConfigWidget::saveSettings(KABPrefs* prefs)
196 209
197void KABConfigWidget::defaults(KABPrefs* prefs) 210void KABConfigWidget::defaults(KABPrefs* prefs)
198{ 211{
199 mNameParsing->setChecked( true ); 212 mNameParsing->setChecked( true );
200 mViewsSingleClickBox->setChecked( false ); 213 mViewsSingleClickBox->setChecked( false );
201 mMultipleViewsAtOnce->setChecked( true ); 214 mMultipleViewsAtOnce->setChecked( true );
215 mAskForQuit->setChecked (true);
202 216
203 emit changed( true ); 217 emit changed( true );
204} 218}
205 219
206void KABConfigWidget::modified() 220void KABConfigWidget::modified()
207{ 221{
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index 2928495..831efc1 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -66,12 +66,13 @@ class KABConfigWidget : public QWidget
66 66
67 KListView *mExtensionView; 67 KListView *mExtensionView;
68 68
69 QCheckBox *mNameParsing; 69 QCheckBox *mNameParsing;
70 QCheckBox *mViewsSingleClickBox; 70 QCheckBox *mViewsSingleClickBox;
71 QCheckBox *mMultipleViewsAtOnce; 71 QCheckBox *mMultipleViewsAtOnce;
72 QCheckBox *mAskForQuit;
72 73
73 QPushButton *mConfigureButton; 74 QPushButton *mConfigureButton;
74 75
75 AddresseeWidget *mAddresseeWidget; 76 AddresseeWidget *mAddresseeWidget;
76}; 77};
77 78