-rw-r--r-- | kaddressbook/kabprefs.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kaddressbookmain.cpp | 86 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 36 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 1 |
4 files changed, 52 insertions, 73 deletions
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 03c5e76..2425158 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -26,49 +26,49 @@ | |||
26 | //#endif //KAB_EMBEDDED | 26 | //#endif //KAB_EMBEDDED |
27 | 27 | ||
28 | 28 | ||
29 | #include <kconfig.h> | 29 | #include <kconfig.h> |
30 | #include <klocale.h> | 30 | #include <klocale.h> |
31 | #include <kstaticdeleter.h> | 31 | #include <kstaticdeleter.h> |
32 | //US#include <kdebug.h> // defines kdDebug() | 32 | //US#include <kdebug.h> // defines kdDebug() |
33 | 33 | ||
34 | #include "kabprefs.h" | 34 | #include "kabprefs.h" |
35 | 35 | ||
36 | KABPrefs *KABPrefs::sInstance = 0; | 36 | KABPrefs *KABPrefs::sInstance = 0; |
37 | static KStaticDeleter<KABPrefs> staticDeleter; | 37 | static KStaticDeleter<KABPrefs> staticDeleter; |
38 | 38 | ||
39 | KABPrefs::KABPrefs() | 39 | KABPrefs::KABPrefs() |
40 | : KPimPrefs("kaddressbookrc") | 40 | : KPimPrefs("kaddressbookrc") |
41 | { | 41 | { |
42 | KPrefs::setCurrentGroup( "Views" ); | 42 | KPrefs::setCurrentGroup( "Views" ); |
43 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); | 43 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); |
44 | 44 | ||
45 | KPrefs::setCurrentGroup( "General" ); | 45 | KPrefs::setCurrentGroup( "General" ); |
46 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); | 46 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); |
47 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); | 47 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); |
48 | 48 | ||
49 | #ifdef KAB_EMBEDDED | 49 | #ifdef KAB_EMBEDDED |
50 | addItemBool("AskForQuit",&mAskForQuit,false); | 50 | addItemBool("AskForQuit",&mAskForQuit,true); |
51 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 51 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
52 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 52 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
53 | 53 | ||
54 | #endif //KAB_EMBEDDED | 54 | #endif //KAB_EMBEDDED |
55 | 55 | ||
56 | KPrefs::setCurrentGroup( "MainWindow" ); | 56 | KPrefs::setCurrentGroup( "MainWindow" ); |
57 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); | 57 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); |
58 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); | 58 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); |
59 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); | 59 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); |
60 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); | 60 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); |
61 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); | 61 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); |
62 | 62 | ||
63 | 63 | ||
64 | KPrefs::setCurrentGroup( "Extensions_General" ); | 64 | KPrefs::setCurrentGroup( "Extensions_General" ); |
65 | QStringList defaultExtensions; | 65 | QStringList defaultExtensions; |
66 | defaultExtensions << "merge"; | 66 | defaultExtensions << "merge"; |
67 | defaultExtensions << "distribution_list_editor"; | 67 | defaultExtensions << "distribution_list_editor"; |
68 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); | 68 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); |
69 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); | 69 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); |
70 | 70 | ||
71 | KPrefs::setCurrentGroup( "Views" ); | 71 | KPrefs::setCurrentGroup( "Views" ); |
72 | QString defaultView = i18n( "Default Table View" ); | 72 | QString defaultView = i18n( "Default Table View" ); |
73 | addItemString( "CurrentView", &mCurrentView, defaultView ); | 73 | addItemString( "CurrentView", &mCurrentView, defaultView ); |
74 | addItemStringList( "ViewNames", &mViewNames, defaultView ); | 74 | addItemStringList( "ViewNames", &mViewNames, defaultView ); |
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp index 8ebb93a..f48f214 100644 --- a/kaddressbook/kaddressbookmain.cpp +++ b/kaddressbook/kaddressbookmain.cpp | |||
@@ -178,99 +178,63 @@ void KAddressBookMain::configureToolbars() | |||
178 | qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" ); | 178 | qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" ); |
179 | #endif //KAB_EMBEDDED | 179 | #endif //KAB_EMBEDDED |
180 | } | 180 | } |
181 | 181 | ||
182 | void KAddressBookMain::slotNewToolbarConfig() | 182 | void KAddressBookMain::slotNewToolbarConfig() |
183 | { | 183 | { |
184 | #ifndef KAB_EMBEDDED | 184 | #ifndef KAB_EMBEDDED |
185 | applyMainWindowSettings( KGlobal::config(), "MainWindow" ); | 185 | applyMainWindowSettings( KGlobal::config(), "MainWindow" ); |
186 | #else //KAB_EMBEDDED | 186 | #else //KAB_EMBEDDED |
187 | qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" ); | 187 | qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" ); |
188 | #endif //KAB_EMBEDDED | 188 | #endif //KAB_EMBEDDED |
189 | } | 189 | } |
190 | 190 | ||
191 | void KAddressBookMain::configureKeys() | 191 | void KAddressBookMain::configureKeys() |
192 | { | 192 | { |
193 | #ifndef KAB_EMBEDDED | 193 | #ifndef KAB_EMBEDDED |
194 | KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this ); | 194 | KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this ); |
195 | #else //KAB_EMBEDDED | 195 | #else //KAB_EMBEDDED |
196 | qDebug("KAddressBookMain::configureKeys() not implemented by ulf" ); | 196 | qDebug("KAddressBookMain::configureKeys() not implemented by ulf" ); |
197 | #endif //KAB_EMBEDDED | 197 | #endif //KAB_EMBEDDED |
198 | } | 198 | } |
199 | 199 | ||
200 | void KAddressBookMain::closeEvent( QCloseEvent* ce ) | 200 | void KAddressBookMain::closeEvent( QCloseEvent* ce ) |
201 | { | 201 | { |
202 | QString mess = i18n( "Close KA/Pi?"); | 202 | bool mModified = mCore->modified(); |
203 | if ( mCore->modified() ) | 203 | bool mAskForQuit = KABPrefs::instance()->mAskForQuit; |
204 | mess += i18n( "\n\nChanges will be saved!"); | ||
205 | else | ||
206 | mess += i18n( "\n\nNo unsaved changes detected!\nNothing will be saved!"); | ||
207 | |||
208 | switch( QMessageBox::information( this, "KA/Pi", mess , | ||
209 | i18n("Yes!"), i18n("No"), 0, 0 ) ) { | ||
210 | case 0: | ||
211 | |||
212 | break; | ||
213 | case 1: | ||
214 | return; | ||
215 | break; | ||
216 | case 2: | ||
217 | return; | ||
218 | break; | ||
219 | |||
220 | default: | ||
221 | return; | ||
222 | break; | ||
223 | } | ||
224 | 204 | ||
225 | #if 0 | 205 | QString mess = i18n( "Close KA/Pi?"); |
206 | if ( mModified == true ) | ||
207 | mess += i18n( "\nChanges will be saved!"); | ||
208 | else | ||
209 | mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); | ||
226 | 210 | ||
227 | if ( mCore->modified() ) { | 211 | bool mQuit = true; |
228 | QString text = i18n( "The address book has been modified.\nDo you want to save your changes?" ); | ||
229 | 212 | ||
230 | #ifndef KAB_EMBEDDED | ||
231 | int ret = KMessageBox::warningYesNoCancel( this, text, "", | ||
232 | KStdGuiItem::yes(), | ||
233 | KStdGuiItem::no(), "AskForSave" ); | ||
234 | switch ( ret ) { | ||
235 | case KMessageBox::Yes: | ||
236 | save(); | ||
237 | break; | ||
238 | case KMessageBox::No: | ||
239 | return true; | ||
240 | break; | ||
241 | default: //cancel | ||
242 | return ; | ||
243 | break; | ||
244 | } | ||
245 | 213 | ||
246 | #else //KAB_EMBEDDED | 214 | if (mAskForQuit) |
247 | switch( QMessageBox::information( this, "KA/Pi", | 215 | { |
248 | text, | 216 | |
249 | i18n("Yes!"), i18n("No"), 0, 0 ) ) { | 217 | int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); |
250 | case 0: | 218 | if (res == 0) |
251 | save(); | 219 | mQuit = true; |
252 | break; | 220 | else |
253 | case 1: | 221 | mQuit = false; |
254 | break; | ||
255 | case 2: | ||
256 | return; | ||
257 | default: | ||
258 | return; | ||
259 | break; | ||
260 | } | ||
261 | #endif //KAB_EMBEDDED | ||
262 | } | 222 | } |
263 | 223 | ||
264 | #endif | 224 | if (mQuit == false) |
225 | return; | ||
226 | |||
227 | if (mModified == true) | ||
228 | { | ||
229 | save(); | ||
230 | mCore->saveSettings(); | ||
231 | KABPrefs::instance()->writeConfig(); | ||
232 | } | ||
265 | 233 | ||
266 | save(); | ||
267 | mCore->saveSettings(); | ||
268 | KABPrefs::instance()->writeConfig(); | ||
269 | ce->accept(); | 234 | ce->accept(); |
270 | |||
271 | } | 235 | } |
272 | 236 | ||
273 | #ifndef KAB_EMBEDDED | 237 | #ifndef KAB_EMBEDDED |
274 | #include "kaddressbookmain.moc" | 238 | #include "kaddressbookmain.moc" |
275 | #endif //KAB_EMBEDDED | 239 | #endif //KAB_EMBEDDED |
276 | 240 | ||
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 | |||
@@ -10,48 +10,49 @@ | |||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
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> |
40 | #include <kglobal.h> | 41 | #include <kglobal.h> |
41 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
42 | #include <kstandarddirs.h> | 43 | #include <kstandarddirs.h> |
43 | 44 | ||
44 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
45 | #include <ktrader.h> | 46 | #include <ktrader.h> |
46 | #else // KAB_EMBEDDED | 47 | #else // KAB_EMBEDDED |
47 | #include <mergewidget.h> | 48 | #include <mergewidget.h> |
48 | #include <distributionlistwidget.h> | 49 | #include <distributionlistwidget.h> |
49 | #endif // KAB_EMBEDDED | 50 | #endif // KAB_EMBEDDED |
50 | 51 | ||
51 | #include "addresseewidget.h" | 52 | #include "addresseewidget.h" |
52 | #include "extensionconfigdialog.h" | 53 | #include "extensionconfigdialog.h" |
53 | #include "extensionwidget.h" | 54 | #include "extensionwidget.h" |
54 | #include "kabprefs.h" | 55 | #include "kabprefs.h" |
55 | 56 | ||
56 | #include "kabconfigwidget.h" | 57 | #include "kabconfigwidget.h" |
57 | 58 | ||
@@ -77,149 +78,162 @@ class ExtensionItem : public QCheckListItem | |||
77 | KService::Ptr mPtr; | 78 | KService::Ptr mPtr; |
78 | #else //KAB_EMBEDDED | 79 | #else //KAB_EMBEDDED |
79 | ExtensionFactory* mFactory; | 80 | ExtensionFactory* mFactory; |
80 | QString mName; | 81 | QString mName; |
81 | QString mComment; | 82 | QString mComment; |
82 | 83 | ||
83 | #endif //KAB_EMBEDDED | 84 | #endif //KAB_EMBEDDED |
84 | 85 | ||
85 | }; | 86 | }; |
86 | 87 | ||
87 | KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | 88 | KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) |
88 | : QWidget( parent, name ) | 89 | : QWidget( parent, name ) |
89 | { | 90 | { |
90 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 91 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
91 | KDialog::spacingHint() ); | 92 | KDialog::spacingHint() ); |
92 | 93 | ||
93 | QTabWidget *tabWidget = new QTabWidget( this ); | 94 | QTabWidget *tabWidget = new QTabWidget( this ); |
94 | topLayout->addWidget( tabWidget ); | 95 | topLayout->addWidget( tabWidget ); |
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); |
129 | mExtensionView = new KListView( groupBox ); | 139 | mExtensionView = new KListView( groupBox ); |
130 | mExtensionView->setAllColumnsShowFocus( true ); | 140 | mExtensionView->setAllColumnsShowFocus( true ); |
131 | mExtensionView->addColumn( i18n( "Name" ) ); | 141 | mExtensionView->addColumn( i18n( "Name" ) ); |
132 | mExtensionView->addColumn( i18n( "Description" ) ); | 142 | mExtensionView->addColumn( i18n( "Description" ) ); |
133 | mExtensionView->setMaximumHeight(80); | 143 | mExtensionView->setMaximumHeight(80); |
134 | 144 | ||
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 | ||
160 | } | 171 | } |
161 | 172 | ||
162 | 173 | ||
163 | void KABConfigWidget::restoreSettings(KABPrefs* prefs) | 174 | void KABConfigWidget::restoreSettings(KABPrefs* prefs) |
164 | { | 175 | { |
165 | //US prefs was KABPrefs::instance() before | 176 | //US prefs was KABPrefs::instance() before |
166 | 177 | ||
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 ); |
179 | 191 | ||
180 | emit changed( false ); | 192 | emit changed( false ); |
181 | } | 193 | } |
182 | 194 | ||
183 | void KABConfigWidget::saveSettings(KABPrefs* prefs) | 195 | void 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 | ||
194 | emit changed( false ); | 207 | emit changed( false ); |
195 | } | 208 | } |
196 | 209 | ||
197 | void KABConfigWidget::defaults(KABPrefs* prefs) | 210 | void 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 | ||
206 | void KABConfigWidget::modified() | 220 | void KABConfigWidget::modified() |
207 | { | 221 | { |
208 | emit changed( true ); | 222 | emit changed( true ); |
209 | } | 223 | } |
210 | 224 | ||
211 | void KABConfigWidget::restoreExtensionSettings() | 225 | void KABConfigWidget::restoreExtensionSettings() |
212 | { | 226 | { |
213 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; | 227 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; |
214 | 228 | ||
215 | mExtensionView->clear(); | 229 | mExtensionView->clear(); |
216 | 230 | ||
217 | #ifndef KAB_EMBEDDED | 231 | #ifndef KAB_EMBEDDED |
218 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); | 232 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); |
219 | KTrader::OfferList::ConstIterator it; | 233 | KTrader::OfferList::ConstIterator it; |
220 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 234 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
221 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) | 235 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) |
222 | continue; | 236 | continue; |
223 | 237 | ||
224 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); | 238 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); |
225 | item->setService( *it ); | 239 | item->setService( *it ); |
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 | |||
@@ -48,31 +48,32 @@ class KABConfigWidget : public QWidget | |||
48 | void defaults(KABPrefs* prefs); | 48 | void defaults(KABPrefs* prefs); |
49 | 49 | ||
50 | signals: | 50 | signals: |
51 | void changed( bool ); | 51 | void changed( bool ); |
52 | 52 | ||
53 | public slots: | 53 | public slots: |
54 | void modified(); | 54 | void modified(); |
55 | 55 | ||
56 | 56 | ||
57 | 57 | ||
58 | private slots: | 58 | private slots: |
59 | void configureExtension(); | 59 | void configureExtension(); |
60 | void selectionChanged( QListViewItem* ); | 60 | void selectionChanged( QListViewItem* ); |
61 | void itemClicked( QListViewItem* ); | 61 | void itemClicked( QListViewItem* ); |
62 | 62 | ||
63 | private: | 63 | private: |
64 | void restoreExtensionSettings(); | 64 | void restoreExtensionSettings(); |
65 | void saveExtensionSettings(); | 65 | void saveExtensionSettings(); |
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 | ||
78 | #endif | 79 | #endif |