7 #include <QtCore/QFile>
9 class KGpgSettingsHelper
12 KGpgSettingsHelper() : q(0) {}
13 ~KGpgSettingsHelper() {
delete q; }
16 K_GLOBAL_STATIC(KGpgSettingsHelper, s_globalKGpgSettings)
19 if (!s_globalKGpgSettings->q) {
21 s_globalKGpgSettings->q->readConfig();
24 return s_globalKGpgSettings->q;
30 Q_ASSERT(!s_globalKGpgSettings->q);
31 s_globalKGpgSettings->q =
this;
32 setCurrentGroup( QLatin1String(
"Decryption" ) );
34 KConfigSkeleton::ItemString *itemCustomDecrypt;
35 itemCustomDecrypt =
new KConfigSkeleton::ItemString( currentGroup(), QLatin1String(
"custom_decrypt" ),
mCustomDecrypt );
36 addItem( itemCustomDecrypt, QLatin1String(
"CustomDecrypt" ) );
38 setCurrentGroup( QLatin1String(
"Encryption" ) );
40 KConfigSkeleton::ItemString *itemCustomEncryptionOptions;
41 itemCustomEncryptionOptions =
new KConfigSkeleton::ItemString( currentGroup(), QLatin1String(
"custom_option" ),
mCustomEncryptionOptions );
42 addItem( itemCustomEncryptionOptions, QLatin1String(
"CustomEncryptionOptions" ) );
43 KConfigSkeleton::ItemBool *itemAllowCustomEncryptionOptions;
44 itemAllowCustomEncryptionOptions =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"allow_custom_option" ),
mAllowCustomEncryptionOptions,
false );
45 addItem( itemAllowCustomEncryptionOptions, QLatin1String(
"AllowCustomEncryptionOptions" ) );
46 KConfigSkeleton::ItemString *itemFileEncryptionKey;
47 itemFileEncryptionKey =
new KConfigSkeleton::ItemString( currentGroup(), QLatin1String(
"file key" ),
mFileEncryptionKey );
48 addItem( itemFileEncryptionKey, QLatin1String(
"FileEncryptionKey" ) );
49 KConfigSkeleton::ItemBool *itemEncryptFilesTo;
50 itemEncryptFilesTo =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"encrypt_files_to" ),
mEncryptFilesTo,
false );
51 addItem( itemEncryptFilesTo, QLatin1String(
"EncryptFilesTo" ) );
52 KConfigSkeleton::ItemBool *itemAsciiArmor;
53 itemAsciiArmor =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"Ascii_armor" ),
mAsciiArmor,
true );
54 addItem( itemAsciiArmor, QLatin1String(
"AsciiArmor" ) );
55 KConfigSkeleton::ItemBool *itemAllowUntrustedKeys;
56 itemAllowUntrustedKeys =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"Allow_untrusted_keys" ),
mAllowUntrustedKeys,
false );
57 addItem( itemAllowUntrustedKeys, QLatin1String(
"AllowUntrustedKeys" ) );
58 KConfigSkeleton::ItemBool *itemAllowUntrustedGroupMembers;
59 itemAllowUntrustedGroupMembers =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"Allow_untrusted_group_members" ),
mAllowUntrustedGroupMembers,
false );
60 addItem( itemAllowUntrustedGroupMembers, QLatin1String(
"AllowUntrustedGroupMembers" ) );
61 KConfigSkeleton::ItemBool *itemHideUserID;
62 itemHideUserID =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"Hide_user_ID" ),
mHideUserID,
false );
63 addItem( itemHideUserID, QLatin1String(
"HideUserID" ) );
64 KConfigSkeleton::ItemBool *itemPgpCompatibility;
65 itemPgpCompatibility =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"PGP_compatibility" ),
mPgpCompatibility,
false );
66 addItem( itemPgpCompatibility, QLatin1String(
"PgpCompatibility" ) );
67 KConfigSkeleton::ItemBool *itemPgpExtension;
68 itemPgpExtension =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"Pgp_extension" ),
mPgpExtension,
false );
69 addItem( itemPgpExtension, QLatin1String(
"PgpExtension" ) );
71 setCurrentGroup( QLatin1String(
"GPG Settings" ) );
73 KConfigSkeleton::ItemPath *itemGpgConfigPath;
74 itemGpgConfigPath =
new KConfigSkeleton::ItemPath( currentGroup(), QLatin1String(
"gpg_config_path" ),
mGpgConfigPath );
75 addItem( itemGpgConfigPath, QLatin1String(
"GpgConfigPath" ) );
76 KConfigSkeleton::ItemPath *itemGpgBinaryPath;
77 itemGpgBinaryPath =
new KConfigSkeleton::ItemPath( currentGroup(), QLatin1String(
"gpg_bin_path" ),
mGpgBinaryPath, QLatin1String(
"gpg" ) );
78 addItem( itemGpgBinaryPath, QLatin1String(
"GpgBinaryPath" ) );
80 setCurrentGroup( QLatin1String(
"General Options" ) );
84 KConfigSkeleton::ItemEnum::Choice2 choice;
85 choice.name = QLatin1String(
"Disable");
86 valuesPhotoProperties.append( choice );
89 KConfigSkeleton::ItemEnum::Choice2 choice;
90 choice.name = QLatin1String(
"Small");
91 valuesPhotoProperties.append( choice );
94 KConfigSkeleton::ItemEnum::Choice2 choice;
95 choice.name = QLatin1String(
"Medium");
96 valuesPhotoProperties.append( choice );
99 KConfigSkeleton::ItemEnum::Choice2 choice;
100 choice.name = QLatin1String(
"Big");
101 valuesPhotoProperties.append( choice );
103 KConfigSkeleton::ItemEnum *itemPhotoProperties;
105 addItem( itemPhotoProperties, QLatin1String(
"PhotoProperties" ) );
106 KConfigSkeleton::ItemBool *itemFirstRun;
107 itemFirstRun =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"First run" ),
mFirstRun,
true );
108 addItem( itemFirstRun, QLatin1String(
"FirstRun" ) );
109 KConfigSkeleton::ItemSize *itemEditorGeometry;
110 itemEditorGeometry =
new KConfigSkeleton::ItemSize( currentGroup(), QLatin1String(
"Geometry" ),
mEditorGeometry );
111 addItem( itemEditorGeometry, QLatin1String(
"EditorGeometry" ) );
112 KConfigSkeleton::ItemBool *itemShowTrust;
113 itemShowTrust =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"show_trust" ),
mShowTrust,
true );
114 addItem( itemShowTrust, QLatin1String(
"ShowTrust" ) );
115 KConfigSkeleton::ItemBool *itemShowExpi;
116 itemShowExpi =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"show_expi" ),
mShowExpi,
true );
117 addItem( itemShowExpi, QLatin1String(
"ShowExpi" ) );
118 KConfigSkeleton::ItemBool *itemShowSize;
119 itemShowSize =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"show_size" ),
mShowSize,
true );
120 addItem( itemShowSize, QLatin1String(
"ShowSize" ) );
121 KConfigSkeleton::ItemBool *itemShowCreat;
122 itemShowCreat =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"show_creat" ),
mShowCreat,
true );
123 addItem( itemShowCreat, QLatin1String(
"ShowCreat" ) );
124 KConfigSkeleton::ItemBool *itemShowSecret;
125 itemShowSecret =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"show_secret" ),
mShowSecret,
false );
126 addItem( itemShowSecret, QLatin1String(
"ShowSecret" ) );
127 KConfigSkeleton::ItemBool *itemShowLongKeyId;
128 itemShowLongKeyId =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"show_long_keyid" ),
mShowLongKeyId,
false );
129 addItem( itemShowLongKeyId, QLatin1String(
"ShowLongKeyId" ) );
132 KConfigSkeleton::ItemEnum::Choice2 choice;
133 choice.name = QLatin1String(
"Unknown");
134 valuesTrustLevel.append( choice );
137 KConfigSkeleton::ItemEnum::Choice2 choice;
138 choice.name = QLatin1String(
"Undefined");
139 valuesTrustLevel.append( choice );
142 KConfigSkeleton::ItemEnum::Choice2 choice;
143 choice.name = QLatin1String(
"Marginal");
144 valuesTrustLevel.append( choice );
147 KConfigSkeleton::ItemEnum::Choice2 choice;
148 choice.name = QLatin1String(
"Full");
149 valuesTrustLevel.append( choice );
152 KConfigSkeleton::ItemEnum::Choice2 choice;
153 choice.name = QLatin1String(
"Ultimate");
154 valuesTrustLevel.append( choice );
156 KConfigSkeleton::ItemEnum *itemTrustLevel;
158 addItem( itemTrustLevel, QLatin1String(
"TrustLevel" ) );
160 setCurrentGroup( QLatin1String(
"User Interface" ) );
162 KConfigSkeleton::ItemBool *itemUseMouseSelection;
163 itemUseMouseSelection =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"selection_clipboard" ),
mUseMouseSelection,
false );
164 addItem( itemUseMouseSelection, QLatin1String(
"UseMouseSelection" ) );
165 KConfigSkeleton::ItemBool *itemAutoStart;
166 itemAutoStart =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"AutoStart" ),
mAutoStart,
false );
167 addItem( itemAutoStart, QLatin1String(
"AutoStart" ) );
168 KConfigSkeleton::ItemBool *itemRemoteFileWarn;
169 itemRemoteFileWarn =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"remote_file_warn" ),
mRemoteFileWarn,
false );
170 addItem( itemRemoteFileWarn, QLatin1String(
"RemoteFileWarn" ) );
173 KConfigSkeleton::ItemEnum::Choice2 choice;
174 choice.name = QLatin1String(
"KeyManager");
175 valuesLeftClick.append( choice );
178 KConfigSkeleton::ItemEnum::Choice2 choice;
179 choice.name = QLatin1String(
"Editor");
180 valuesLeftClick.append( choice );
182 KConfigSkeleton::ItemEnum *itemLeftClick;
183 itemLeftClick =
new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String(
"left_click" ),
mLeftClick, valuesLeftClick );
184 addItem( itemLeftClick, QLatin1String(
"LeftClick" ) );
187 KConfigSkeleton::ItemEnum::Choice2 choice;
188 choice.name = QLatin1String(
"DecryptAndSave");
189 valuesEncryptedDropEvent.append( choice );
192 KConfigSkeleton::ItemEnum::Choice2 choice;
193 choice.name = QLatin1String(
"DecryptAndOpen");
194 valuesEncryptedDropEvent.append( choice );
197 KConfigSkeleton::ItemEnum::Choice2 choice;
198 choice.name = QLatin1String(
"Ask");
199 valuesEncryptedDropEvent.append( choice );
201 KConfigSkeleton::ItemEnum *itemEncryptedDropEvent;
202 itemEncryptedDropEvent =
new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String(
"encrypted_drop_event" ),
mEncryptedDropEvent, valuesEncryptedDropEvent );
203 addItem( itemEncryptedDropEvent, QLatin1String(
"EncryptedDropEvent" ) );
206 KConfigSkeleton::ItemEnum::Choice2 choice;
207 choice.name = QLatin1String(
"Encrypt");
208 valuesUnencryptedDropEvent.append( choice );
211 KConfigSkeleton::ItemEnum::Choice2 choice;
212 choice.name = QLatin1String(
"Sign");
213 valuesUnencryptedDropEvent.append( choice );
216 KConfigSkeleton::ItemEnum::Choice2 choice;
217 choice.name = QLatin1String(
"Ask");
218 valuesUnencryptedDropEvent.append( choice );
220 KConfigSkeleton::ItemEnum *itemUnencryptedDropEvent;
221 itemUnencryptedDropEvent =
new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String(
"unencrypted_drop_event" ),
mUnencryptedDropEvent, valuesUnencryptedDropEvent );
222 addItem( itemUnencryptedDropEvent, QLatin1String(
"UnencryptedDropEvent" ) );
225 KConfigSkeleton::ItemEnum::Choice2 choice;
226 choice.name = QLatin1String(
"Disabled");
227 valuesSignMenu.append( choice );
230 KConfigSkeleton::ItemEnum::Choice2 choice;
231 choice.name = QLatin1String(
"AllFiles");
232 valuesSignMenu.append( choice );
234 KConfigSkeleton::ItemEnum *itemSignMenu;
236 addItem( itemSignMenu, QLatin1String(
"SignMenu" ) );
239 KConfigSkeleton::ItemEnum::Choice2 choice;
240 choice.name = QLatin1String(
"Disabled");
241 valuesDecryptMenu.append( choice );
244 KConfigSkeleton::ItemEnum::Choice2 choice;
245 choice.name = QLatin1String(
"AllFiles");
246 valuesDecryptMenu.append( choice );
249 KConfigSkeleton::ItemEnum::Choice2 choice;
250 choice.name = QLatin1String(
"EncryptedFiles");
251 valuesDecryptMenu.append( choice );
253 KConfigSkeleton::ItemEnum *itemDecryptMenu;
255 addItem( itemDecryptMenu, QLatin1String(
"DecryptMenu" ) );
256 KConfigSkeleton::ItemBool *itemShowSystray;
257 itemShowSystray =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"systray_icon" ),
mShowSystray,
true );
258 addItem( itemShowSystray, QLatin1String(
"ShowSystray" ) );
259 KConfigSkeleton::ItemUInt *itemRecentFiles;
260 itemRecentFiles =
new KConfigSkeleton::ItemUInt( currentGroup(), QLatin1String(
"recent_files" ),
mRecentFiles, 10 );
261 addItem( itemRecentFiles, QLatin1String(
"RecentFiles" ) );
263 setCurrentGroup( QLatin1String(
"TipOfDay" ) );
265 KConfigSkeleton::ItemBool *itemShowTipOfDay;
266 itemShowTipOfDay =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"RunOnStart" ),
mShowTipOfDay,
true );
267 addItem( itemShowTipOfDay, QLatin1String(
"ShowTipOfDay" ) );
269 setCurrentGroup( QLatin1String(
"Key Colors" ) );
271 KConfigSkeleton::ItemColor *itemColorGood;
272 itemColorGood =
new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String(
"color_good" ),
mColorGood, QColor( 144,255,0 ) );
273 addItem( itemColorGood, QLatin1String(
"ColorGood" ) );
274 KConfigSkeleton::ItemColor *itemColorRev;
275 itemColorRev =
new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String(
"color_revoked" ),
mColorRev, QColor( 30,30,30 ) );
276 addItem( itemColorRev, QLatin1String(
"ColorRev" ) );
277 KConfigSkeleton::ItemColor *itemColorUnknown;
278 itemColorUnknown =
new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String(
"color_unknown" ),
mColorUnknown, QColor( 255,255,255 ) );
279 addItem( itemColorUnknown, QLatin1String(
"ColorUnknown" ) );
280 KConfigSkeleton::ItemColor *itemColorBad;
281 itemColorBad =
new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String(
"color_bad" ),
mColorBad, QColor( 172,0,0 ) );
282 addItem( itemColorBad, QLatin1String(
"ColorBad" ) );
283 KConfigSkeleton::ItemColor *itemColorUltimate;
284 itemColorUltimate =
new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String(
"color_ultimate" ),
mColorUltimate, QColor( 68,0,255 ) );
285 addItem( itemColorUltimate, QLatin1String(
"ColorUltimate" ) );
286 KConfigSkeleton::ItemColor *itemColorMarginal;
287 itemColorMarginal =
new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String(
"color_marginal" ),
mColorMarginal, QColor( 255,255,0 ) );
288 addItem( itemColorMarginal, QLatin1String(
"ColorMarginal" ) );
289 KConfigSkeleton::ItemColor *itemColorExpired;
290 itemColorExpired =
new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String(
"color_expired" ),
mColorExpired, QColor( 150,150,150 ) );
291 addItem( itemColorExpired, QLatin1String(
"ColorExpired" ) );
293 setCurrentGroup( QLatin1String(
"Text Font" ) );
295 KConfigSkeleton::ItemFont *itemFont;
296 itemFont =
new KConfigSkeleton::ItemFont( currentGroup(), QLatin1String(
"KEditFont" ),
mFont, KGlobalSettings::fixedFont() );
297 addItem( itemFont, QLatin1String(
"Font" ) );
299 setCurrentGroup( QLatin1String(
"Key List" ) );
303 KConfigSkeleton::ItemEnum::Choice2 choice;
304 choice.name = QLatin1String(
"Alphabetical");
305 valuesEmailSorting.append( choice );
308 KConfigSkeleton::ItemEnum::Choice2 choice;
309 choice.name = QLatin1String(
"TLDfirst");
310 valuesEmailSorting.append( choice );
313 KConfigSkeleton::ItemEnum::Choice2 choice;
314 choice.name = QLatin1String(
"DomainFirst");
315 valuesEmailSorting.append( choice );
318 KConfigSkeleton::ItemEnum::Choice2 choice;
319 choice.name = QLatin1String(
"FQDNFirst");
320 valuesEmailSorting.append( choice );
322 KConfigSkeleton::ItemEnum *itemEmailSorting;
324 addItem( itemEmailSorting, QLatin1String(
"EmailSorting" ) );
326 setCurrentGroup( QLatin1String(
"Servers" ) );
328 QStringList defaultKeyServers;
329 defaultKeyServers.append( QString::fromUtf8(
"hkp://wwwkeys.pgp.net" ) );
330 defaultKeyServers.append( QString::fromUtf8(
"hkp://pgp.dtype.org" ) );
331 defaultKeyServers.append( QString::fromUtf8(
"hkp://search.keyserver.net" ) );
332 defaultKeyServers.append( QString::fromUtf8(
"hkp://subkeys.pgp.net" ) );
333 defaultKeyServers.append( QString::fromUtf8(
"hkp://wwwkeys.pgp.net" ) );
334 defaultKeyServers.append( QString::fromUtf8(
"hkp://wwwkeys.us.pgp.net" ) );
336 KConfigSkeleton::ItemStringList *itemKeyServers;
337 itemKeyServers =
new KConfigSkeleton::ItemStringList( currentGroup(), QLatin1String(
"Server_List" ),
mKeyServers, defaultKeyServers );
338 addItem( itemKeyServers, QLatin1String(
"KeyServers" ) );
339 QStringList defaultInfoServers;
340 defaultInfoServers.append( QString::fromUtf8(
"http://pgp.cs.uu.nl/stats/$$ID8$$.html" ) );
341 defaultInfoServers.append( QString::fromUtf8(
"http://webware.lysator.liu.se/jc/wotsap/wots/latest/keystatistics/0x$$ID8$$.txt" ) );
342 defaultInfoServers.append( QString::fromUtf8(
"http://pgp.surfnet.nl:11371/pks/lookup?op=vindex&fingerprint=on&search=0x$$ID8$$;http://biglumber.com/x/web?pk=$$FPR$$" ) );
344 KConfigSkeleton::ItemStringList *itemInfoServers;
345 itemInfoServers =
new KConfigSkeleton::ItemStringList( currentGroup(), QLatin1String(
"Info_Server_List" ),
mInfoServers, defaultInfoServers );
346 addItem( itemInfoServers, QLatin1String(
"InfoServers" ) );
348 setCurrentGroup( QLatin1String(
"Key Servers" ) );
350 KConfigSkeleton::ItemBool *itemUseProxy;
351 itemUseProxy =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"use_proxy" ),
mUseProxy,
false );
352 addItem( itemUseProxy, QLatin1String(
"UseProxy" ) );
354 setCurrentGroup( QLatin1String(
"Key Signing" ) );
356 KConfigSkeleton::ItemString *itemEmailTemplate;
358 addItem( itemEmailTemplate, QLatin1String(
"EmailTemplate" ) );
361 KConfigSkeleton::ItemEnum::Choice2 choice;
362 choice.name = QLatin1String(
"All");
363 valuesMailUats.append( choice );
366 KConfigSkeleton::ItemEnum::Choice2 choice;
367 choice.name = QLatin1String(
"First");
368 valuesMailUats.append( choice );
371 KConfigSkeleton::ItemEnum::Choice2 choice;
372 choice.name = QLatin1String(
"None");
373 valuesMailUats.append( choice );
375 KConfigSkeleton::ItemEnum *itemMailUats;
376 itemMailUats =
new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String(
"Mail_Uats" ),
mMailUats, valuesMailUats,
EnumMailUats::All );
377 addItem( itemMailUats, QLatin1String(
"MailUats" ) );
382 if (!s_globalKGpgSettings.isDestroyed()) {
383 s_globalKGpgSettings->q = 0;
int mUnencryptedDropEvent
bool mAllowUntrustedGroupMembers
QString mCustomEncryptionOptions
static const char *const EMailTemplateText
QString mFileEncryptionKey
bool mAllowCustomEncryptionOptions