9 #include <QtCore/QFile>
14 SettingsHelper() : q(0) {}
15 ~SettingsHelper() {
delete q; }
18 K_GLOBAL_STATIC(SettingsHelper, s_globalSettings)
21 if (!s_globalSettings->q) {
23 s_globalSettings->q->readConfig();
26 return s_globalSettings->q;
32 Q_ASSERT(!s_globalSettings->q);
33 s_globalSettings->q =
this;
34 setCurrentGroup( QLatin1String(
"Window" ) );
36 mUseSimpleModeItem =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"UseSimpleMode" ),
mUseSimpleMode,
false );
37 mUseSimpleModeItem->setLabel( i18n(
"UseSimpleMode") );
38 mUseSimpleModeItem->setToolTip( i18n(
"Set the view to \\\"Simple Mode\\\"") );
39 mUseSimpleModeItem->setWhatsThis( i18n(
"Set this option to true if you want to use the simple view mode instead of the normal view mode where a list of all your address books and contacts are shown on the display.") );
40 addItem( mUseSimpleModeItem, QLatin1String(
"UseSimpleMode" ) );
42 setCurrentGroup( QLatin1String(
"Printing" ) );
44 mDefaultFileNameItem =
new KConfigSkeleton::ItemString( currentGroup(), QLatin1String(
"DefaultFileName" ),
mDefaultFileName, QLatin1String(
"addressbook.pdf" ) );
45 mDefaultFileNameItem->setLabel( i18n(
"DefaultFileName") );
46 mDefaultFileNameItem->setToolTip( i18n(
"Default print file name") );
47 mDefaultFileNameItem->setWhatsThis( i18n(
"Set the name of the default print file.") );
48 addItem( mDefaultFileNameItem, QLatin1String(
"DefaultFileName" ) );
49 mPrintingStyleItem =
new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String(
"PrintingStyle" ),
mPrintingStyle, 0 );
50 mPrintingStyleItem->setLabel( i18n(
"Printing style") );
51 mPrintingStyleItem->setToolTip( i18n(
"Set the printing style") );
52 mPrintingStyleItem->setWhatsThis( i18n(
"KAddressBook can print the contacts in several styles. With this combobox you can choose one of these.") );
53 addItem( mPrintingStyleItem, QLatin1String(
"PrintingStyle" ) );
54 QList<KConfigSkeleton::ItemEnum::Choice2> valuesSortOrder;
56 KConfigSkeleton::ItemEnum::Choice2 choice;
57 choice.name = QLatin1String(
"Ascending");
58 valuesSortOrder.append( choice );
61 KConfigSkeleton::ItemEnum::Choice2 choice;
62 choice.name = QLatin1String(
"Descending");
63 valuesSortOrder.append( choice );
65 mSortOrderItem =
new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String(
"SortOrder" ),
mSortOrder, valuesSortOrder,
Ascending );
66 mSortOrderItem->setLabel( i18n(
"Default sort order") );
67 mSortOrderItem->setToolTip( i18n(
"Sort order") );
68 mSortOrderItem->setWhatsThis( i18n(
"Choose the sorting order for the printed contacts.") );
69 addItem( mSortOrderItem, QLatin1String(
"SortOrder" ) );
71 setCurrentGroup( QLatin1String(
"Views" ) );
73 QList<int> defaultContactModelColumns;
74 defaultContactModelColumns.append( 0 );
76 mContactModelColumnsItem =
new KConfigSkeleton::ItemIntList( currentGroup(), QLatin1String(
"ContactModelColumns" ),
mContactModelColumns, defaultContactModelColumns );
77 mContactModelColumnsItem->setLabel( i18n(
"ContactModelColumns") );
78 mContactModelColumnsItem->setToolTip( i18n(
"View columns") );
79 mContactModelColumnsItem->setWhatsThis( i18n(
"Set the number of contact model view columns.") );
80 addItem( mContactModelColumnsItem, QLatin1String(
"ContactModelColumns" ) );
81 QList<KConfigSkeleton::ItemEnum::Choice2> valuesViewMode;
83 KConfigSkeleton::ItemEnum::Choice2 choice;
84 choice.name = QLatin1String(
"Dummy");
85 valuesViewMode.append( choice );
88 KConfigSkeleton::ItemEnum::Choice2 choice;
89 choice.name = QLatin1String(
"Simple");
90 valuesViewMode.append( choice );
93 KConfigSkeleton::ItemEnum::Choice2 choice;
94 choice.name = QLatin1String(
"TwoColumn");
95 valuesViewMode.append( choice );
98 KConfigSkeleton::ItemEnum::Choice2 choice;
99 choice.name = QLatin1String(
"ThreeColumn");
100 valuesViewMode.append( choice );
102 mViewModeItem =
new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String(
"ViewMode" ),
mViewMode, valuesViewMode, 3 );
103 mViewModeItem->setLabel( i18n(
"Viewing mode") );
104 mViewModeItem->setToolTip( i18n(
"Viewing mode (number of columns)") );
105 mViewModeItem->setWhatsThis( i18n(
"Choose the layout for the main view") );
106 addItem( mViewModeItem, QLatin1String(
"ViewMode" ) );
111 if (!s_globalSettings.isDestroyed()) {
112 s_globalSettings->q = 0;
QList< int > mContactModelColumns