00001
00002
00003
00004 #include "globalsettings.h"
00005
00006 #include <klocale.h>
00007
00008 #include <kstaticdeleter.h>
00009
00010 GlobalSettings *GlobalSettings::mSelf = 0;
00011 static KStaticDeleter<GlobalSettings> staticGlobalSettingsDeleter;
00012
00013 GlobalSettings *GlobalSettings::self()
00014 {
00015 if ( !mSelf ) {
00016 staticGlobalSettingsDeleter.setObject( mSelf, new GlobalSettings() );
00017 mSelf->readConfig();
00018 }
00019
00020 return mSelf;
00021 }
00022
00023 GlobalSettings::GlobalSettings( )
00024 : KConfigSkeleton( QString::fromLatin1( "kmailrc" ) )
00025 {
00026 mSelf = this;
00027 setCurrentGroup( QString::fromLatin1( "Behaviour" ) );
00028
00029 mDelayedMarkAsReadItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "DelayedMarkAsRead" ), mDelayedMarkAsRead, true );
00030 mDelayedMarkAsReadItem->setLabel( i18n("DelayedMarkAsRead") );
00031 addItem( mDelayedMarkAsReadItem, QString::fromLatin1( "DelayedMarkAsRead" ) );
00032 mDelayedMarkTimeItem = new KConfigSkeleton::ItemUInt( currentGroup(), QString::fromLatin1( "DelayedMarkTime" ), mDelayedMarkTime, 0 );
00033 mDelayedMarkTimeItem->setLabel( i18n("DelayedMarkTime") );
00034 addItem( mDelayedMarkTimeItem, QString::fromLatin1( "DelayedMarkTime" ) );
00035 mJumpToUnreadItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "JumpToUnread" ), mJumpToUnread, false );
00036 mJumpToUnreadItem->setLabel( i18n("JumpToUnread") );
00037 addItem( mJumpToUnreadItem, QString::fromLatin1( "JumpToUnread" ) );
00038 QValueList<KConfigSkeleton::ItemEnum::Choice> valuesLoopOnGotoUnread;
00039 {
00040 KConfigSkeleton::ItemEnum::Choice choice;
00041 choice.name = QString::fromLatin1( "DontLoop" );
00042 valuesLoopOnGotoUnread.append( choice );
00043 }
00044 {
00045 KConfigSkeleton::ItemEnum::Choice choice;
00046 choice.name = QString::fromLatin1( "LoopInCurrentFolder" );
00047 valuesLoopOnGotoUnread.append( choice );
00048 }
00049 {
00050 KConfigSkeleton::ItemEnum::Choice choice;
00051 choice.name = QString::fromLatin1( "LoopInAllFolders" );
00052 valuesLoopOnGotoUnread.append( choice );
00053 }
00054 mLoopOnGotoUnreadItem = new KConfigSkeleton::ItemEnum( currentGroup(), QString::fromLatin1( "LoopOnGotoUnread" ), mLoopOnGotoUnread, valuesLoopOnGotoUnread, EnumLoopOnGotoUnread::DontLoop );
00055 mLoopOnGotoUnreadItem->setLabel( i18n("LoopOnGotoUnread") );
00056 addItem( mLoopOnGotoUnreadItem, QString::fromLatin1( "LoopOnGotoUnread" ) );
00057 mShowPopupAfterDnDItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "ShowPopupAfterDnD" ), mShowPopupAfterDnD, true );
00058 mShowPopupAfterDnDItem->setLabel( i18n("ShowPopupAfterDnD") );
00059 addItem( mShowPopupAfterDnDItem, QString::fromLatin1( "ShowPopupAfterDnD" ) );
00060 mExcludeImportantMailFromExpiryItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "ExcludeImportantMailFromExpiry" ), mExcludeImportantMailFromExpiry, true );
00061 mExcludeImportantMailFromExpiryItem->setLabel( i18n("ExcludeImportantMailFromExpiry") );
00062 addItem( mExcludeImportantMailFromExpiryItem, QString::fromLatin1( "ExcludeImportantMailFromExpiry" ) );
00063 QValueList<KConfigSkeleton::ItemEnum::Choice> valuesSendOnCheck;
00064 {
00065 KConfigSkeleton::ItemEnum::Choice choice;
00066 choice.name = QString::fromLatin1( "DontSendOnCheck" );
00067 valuesSendOnCheck.append( choice );
00068 }
00069 {
00070 KConfigSkeleton::ItemEnum::Choice choice;
00071 choice.name = QString::fromLatin1( "SendOnManualChecks" );
00072 valuesSendOnCheck.append( choice );
00073 }
00074 {
00075 KConfigSkeleton::ItemEnum::Choice choice;
00076 choice.name = QString::fromLatin1( "SendOnAllChecks" );
00077 valuesSendOnCheck.append( choice );
00078 }
00079 mSendOnCheckItem = new KConfigSkeleton::ItemEnum( currentGroup(), QString::fromLatin1( "SendOnCheck" ), mSendOnCheck, valuesSendOnCheck, EnumSendOnCheck::DontSendOnCheck );
00080 mSendOnCheckItem->setLabel( i18n("Send queued mail on mail check") );
00081 mSendOnCheckItem->setWhatsThis( i18n("<qt><p>Select whether you want KMail to send all messages in the outbox on manual or all mail checks, or whether you do not want messages to be sent automatically at all. </p></qt>") );
00082 addItem( mSendOnCheckItem, QString::fromLatin1( "SendOnCheck" ) );
00083
00084 setCurrentGroup( QString::fromLatin1( "FolderSelectionDialog" ) );
00085
00086 mLastSelectedFolderItem = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "LastSelectedFolder" ), mLastSelectedFolder, "inbox" );
00087 mLastSelectedFolderItem->setLabel( i18n("LastSelectedFolder") );
00088 mLastSelectedFolderItem->setWhatsThis( i18n("The most recently selected folder in the folder selection dialog.") );
00089 addItem( mLastSelectedFolderItem, QString::fromLatin1( "LastSelectedFolder" ) );
00090
00091 setCurrentGroup( QString::fromLatin1( "General" ) );
00092
00093 mSystemTrayEnabledItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "SystemTrayEnabled" ), mSystemTrayEnabled, false );
00094 mSystemTrayEnabledItem->setLabel( i18n("Enable system tray icon") );
00095 addItem( mSystemTrayEnabledItem, QString::fromLatin1( "SystemTrayEnabled" ) );
00096 QValueList<KConfigSkeleton::ItemEnum::Choice> valuesSystemTrayPolicy;
00097 {
00098 KConfigSkeleton::ItemEnum::Choice choice;
00099 choice.name = QString::fromLatin1( "ShowAlways" );
00100 valuesSystemTrayPolicy.append( choice );
00101 }
00102 {
00103 KConfigSkeleton::ItemEnum::Choice choice;
00104 choice.name = QString::fromLatin1( "ShowOnUnread" );
00105 valuesSystemTrayPolicy.append( choice );
00106 }
00107 mSystemTrayPolicyItem = new KConfigSkeleton::ItemEnum( currentGroup(), QString::fromLatin1( "SystemTrayPolicy" ), mSystemTrayPolicy, valuesSystemTrayPolicy, EnumSystemTrayPolicy::ShowOnUnread );
00108 mSystemTrayPolicyItem->setLabel( i18n("Policy for showing the system tray icon") );
00109 addItem( mSystemTrayPolicyItem, QString::fromLatin1( "SystemTrayPolicy" ) );
00110 mVerboseNewMailNotificationItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "VerboseNewMailNotification" ), mVerboseNewMailNotification, true );
00111 mVerboseNewMailNotificationItem->setLabel( i18n("Verbose new mail notification") );
00112 mVerboseNewMailNotificationItem->setWhatsThis( i18n("If this option is enabled then for each folder the number of newly arrived messages is shown in the new mail notification; otherwise, you will only get a simple 'New mail arrived' message.") );
00113 addItem( mVerboseNewMailNotificationItem, QString::fromLatin1( "VerboseNewMailNotification" ) );
00114
00115 setCurrentGroup( QString::fromLatin1( "Groupware" ) );
00116
00117 mGroupwareEnabledItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "GroupwareEnabled" ), mGroupwareEnabled, true );
00118 mGroupwareEnabledItem->setLabel( i18n("Enable groupware functionality") );
00119 addItem( mGroupwareEnabledItem, QString::fromLatin1( "GroupwareEnabled" ) );
00120 mLegacyMangleFromToHeadersItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "LegacyMangleFromToHeaders" ), mLegacyMangleFromToHeaders, false );
00121 mLegacyMangleFromToHeadersItem->setLabel( i18n("Mangle From:/To: headers in replies to replies") );
00122 mLegacyMangleFromToHeadersItem->setWhatsThis( i18n("Microsoft Outlook has a number of shortcomings in its implementation of the iCalendar standard; this option works around one of them. If you have problems with Outlook users not being able to get your replies, try setting this option.") );
00123 addItem( mLegacyMangleFromToHeadersItem, QString::fromLatin1( "LegacyMangleFromToHeaders" ) );
00124 mLegacyBodyInvitesItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "LegacyBodyInvites" ), mLegacyBodyInvites, false );
00125 mLegacyBodyInvitesItem->setLabel( i18n("Send groupware invitations in the mail body") );
00126 mLegacyBodyInvitesItem->setWhatsThis( i18n("Microsoft Outlook has a number of shortcomings in its implementation of the iCalendar standard; this option works around one of them. If you have problems with Outlook users not being able to get your invitations, try setting this option.") );
00127 addItem( mLegacyBodyInvitesItem, QString::fromLatin1( "LegacyBodyInvites" ) );
00128
00129 setCurrentGroup( QString::fromLatin1( "IMAP Resource" ) );
00130
00131 mTheIMAPResourceEnabledItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "TheIMAPResourceEnabled" ), mTheIMAPResourceEnabled, false );
00132 mTheIMAPResourceEnabledItem->setLabel( i18n("TheIMAPResourceEnabled") );
00133 mTheIMAPResourceEnabledItem->setWhatsThis( i18n("<p>Enabling this makes it possible to store the entries from the Kontact applications (KOrganizer, KAddressBook, and KNotes.)</p><p>If you want to set this option you must also set the applications to use the IMAP resource; this is done in the KDE Control Center.</p>") );
00134 addItem( mTheIMAPResourceEnabledItem, QString::fromLatin1( "TheIMAPResourceEnabled" ) );
00135 mHideGroupwareFoldersItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "HideGroupwareFolders" ), mHideGroupwareFolders, true );
00136 mHideGroupwareFoldersItem->setLabel( i18n("HideGroupwareFolders") );
00137 mHideGroupwareFoldersItem->setWhatsThis( i18n("<p>Usually you will not have any reason to see the folders that hold the IMAP resources. But if you need to see them, you can set that here.</p>") );
00138 addItem( mHideGroupwareFoldersItem, QString::fromLatin1( "HideGroupwareFolders" ) );
00139 mTheIMAPResourceFolderParentItem = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "TheIMAPResourceFolderParent" ), mTheIMAPResourceFolderParent, "inbox" );
00140 mTheIMAPResourceFolderParentItem->setLabel( i18n("TheIMAPResourceFolderParent") );
00141 mTheIMAPResourceFolderParentItem->setWhatsThis( i18n("<p>This chooses the parent of the IMAP resource folders.</p><p>By default, the Kolab server sets the IMAP inbox to be the parent.</p>") );
00142 addItem( mTheIMAPResourceFolderParentItem, QString::fromLatin1( "TheIMAPResourceFolderParent" ) );
00143 mTheIMAPResourceAccountItem = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "TheIMAPResourceAccount" ), mTheIMAPResourceAccount );
00144 mTheIMAPResourceAccountItem->setLabel( i18n("TheIMAPResourceAccount") );
00145 mTheIMAPResourceAccountItem->setWhatsThis( i18n("<p>This is the ID of the account holding the IMAP resource folders.</p>") );
00146 addItem( mTheIMAPResourceAccountItem, QString::fromLatin1( "TheIMAPResourceAccount" ) );
00147 mTheIMAPResourceFolderLanguageItem = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "TheIMAPResourceFolderLanguage" ), mTheIMAPResourceFolderLanguage, 0 );
00148 mTheIMAPResourceFolderLanguageItem->setLabel( i18n("TheIMAPResourceFolderLanguage") );
00149 mTheIMAPResourceFolderLanguageItem->setWhatsThis( i18n("<p>If you want to set the folder names of the IMAP storage to your local language, you can choose between these available languages.</p><p> Please note, that the only reason to do so is for compatibility with Microsoft Outlook. It is considered a bad idea to set this, since it makes changing languages impossible. </p><p>So do not set this unless you have to.</p>") );
00150 addItem( mTheIMAPResourceFolderLanguageItem, QString::fromLatin1( "TheIMAPResourceFolderLanguage" ) );
00151
00152 setCurrentGroup( QString::fromLatin1( "Internal" ) );
00153
00154 mMsgDictSizeHintItem = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "MsgDictSizeHint" ), mMsgDictSizeHint, 9973 );
00155 mMsgDictSizeHintItem->setLabel( i18n("MsgDictSizeHint") );
00156 addItem( mMsgDictSizeHintItem, QString::fromLatin1( "MsgDictSizeHint" ) );
00157 mPreviousNewFeaturesMD5Item = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "PreviousNewFeaturesMD5" ), mPreviousNewFeaturesMD5 );
00158 mPreviousNewFeaturesMD5Item->setLabel( i18n("PreviousNewFeaturesMD5") );
00159 mPreviousNewFeaturesMD5Item->setWhatsThis( i18n("This value is used to decide whether the KMail Introduction should be displayed.") );
00160 addItem( mPreviousNewFeaturesMD5Item, QString::fromLatin1( "PreviousNewFeaturesMD5" ) );
00161
00162 setCurrentGroup( QString::fromLatin1( "Network" ) );
00163
00164 mMaxConnectionsPerHostItem = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "MaxConnectionsPerHost" ), mMaxConnectionsPerHost, 0 );
00165 mMaxConnectionsPerHostItem->setMinValue(0);
00166 mMaxConnectionsPerHostItem->setLabel( i18n("Maximal number of connections per host") );
00167 mMaxConnectionsPerHostItem->setWhatsThis( i18n("This can be used to restrict the number of connections per host while checking for new mail. By default the number of connections is unlimited (0).") );
00168 addItem( mMaxConnectionsPerHostItem, QString::fromLatin1( "MaxConnectionsPerHost" ) );
00169
00170 setCurrentGroup( QString::fromLatin1( "UserInterface" ) );
00171
00172 mQuickSearchActiveItem = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "QuickSearchActive" ), mQuickSearchActive, true );
00173 mQuickSearchActiveItem->setLabel( i18n("Show quick search line edit") );
00174 mQuickSearchActiveItem->setWhatsThis( i18n("This option enabled or disables the search line edit above the message list which can be used to quickly search the information shown in the message list.") );
00175 addItem( mQuickSearchActiveItem, QString::fromLatin1( "QuickSearchActive" ) );
00176 }
00177
00178 GlobalSettings::~GlobalSettings()
00179 {
00180 if ( mSelf == this )
00181 staticGlobalSettingsDeleter.setObject( mSelf, 0, false );
00182 }
00183