Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| df13ddf6b1 | |||
| c08a625348 | |||
| 4484f19d14 | |||
| ca17e5d433 | |||
| d89e36b962 | |||
| 3092150d3a | |||
| 163dc17b49 | |||
| b7cc335184 |
+1
-1
@@ -2,7 +2,7 @@
|
||||
; Erfordert Inno Setup 6.x (https://jrsoftware.org/isinfo.php)
|
||||
|
||||
#define MyAppName "Starface Outlook Sync"
|
||||
#define MyAppVersion "0.0.0.19"
|
||||
#define MyAppVersion "0.0.0.22"
|
||||
#define MyAppPublisher "HackerSoft - Hacker-Net Telekommunikation"
|
||||
#define MyAppURL "https://www.hacker-net.de"
|
||||
#define MyAppExeName "StarfaceOutlookSync.exe"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace StarfaceOutlookSync.Models
|
||||
@@ -7,6 +8,8 @@ namespace StarfaceOutlookSync.Models
|
||||
public class UserSettings
|
||||
{
|
||||
public bool StartMinimized { get; set; } = false;
|
||||
public bool SyncOnStart { get; set; } = false;
|
||||
public bool AutoAcceptOutlookPrompt { get; set; } = false;
|
||||
|
||||
private static readonly string SettingsFile = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
@@ -32,6 +35,62 @@ namespace StarfaceOutlookSync.Models
|
||||
File.WriteAllText(SettingsFile, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
}
|
||||
catch { }
|
||||
|
||||
ApplyOutlookSecuritySetting();
|
||||
}
|
||||
|
||||
public void ApplyOutlookSecuritySetting()
|
||||
{
|
||||
// Alle Office-Versionen abdecken (16.0 = 2016/2019/2021/2024/365, 15.0 = 2013)
|
||||
// Beide Pfade versuchen: Policies (GPO-Pfad) und direkt (normaler User-Pfad)
|
||||
var versions = new[] { "16.0", "15.0" };
|
||||
var prefixes = new[]
|
||||
{
|
||||
@"Software\Policies\Microsoft\Office", // GPO-Pfad (braucht ggf. Rechte)
|
||||
@"Software\Microsoft\Office" // Normaler User-Pfad (immer schreibbar)
|
||||
};
|
||||
|
||||
var securityValues = new (string name, int value)[]
|
||||
{
|
||||
("ObjectModelGuard", 2),
|
||||
("PromptOOMAddressBookAccess", 2),
|
||||
("PromptOOMAddressInformationAccess", 2),
|
||||
("PromptOOMSend", 2),
|
||||
("PromptOOMSaveAs", 2),
|
||||
("PromptOOMFormulaAccess", 2),
|
||||
("PromptOOMCustomAction", 2),
|
||||
("PromptSimpleMAPISend", 2),
|
||||
("PromptSimpleMAPINameResolve", 2),
|
||||
("PromptSimpleMAPIOpenMessage", 2),
|
||||
("AdminSecurityMode", 3),
|
||||
};
|
||||
|
||||
foreach (var ver in versions)
|
||||
{
|
||||
foreach (var prefix in prefixes)
|
||||
{
|
||||
var regPath = $@"{prefix}\{ver}\Outlook\Security";
|
||||
|
||||
try
|
||||
{
|
||||
if (AutoAcceptOutlookPrompt)
|
||||
{
|
||||
var key = Registry.CurrentUser.CreateSubKey(regPath);
|
||||
if (key != null)
|
||||
{
|
||||
foreach (var (name, value) in securityValues)
|
||||
key.SetValue(name, value, RegistryValueKind.DWord);
|
||||
key.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try { Registry.CurrentUser.DeleteSubKey(regPath, false); } catch { }
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
<AssemblyTitle>Starface Outlook Sync</AssemblyTitle>
|
||||
<Company>HackerSoft - Hacker-Net Telekommunikation</Company>
|
||||
<Product>Starface Outlook Sync</Product>
|
||||
<Version>0.0.0.19</Version>
|
||||
<AssemblyVersion>0.0.0.19</AssemblyVersion>
|
||||
<FileVersion>0.0.0.19</FileVersion>
|
||||
<Version>0.0.0.22</Version>
|
||||
<AssemblyVersion>0.0.0.22</AssemblyVersion>
|
||||
<FileVersion>0.0.0.22</FileVersion>
|
||||
<Description>Synchronisiert Outlook-Kontakte mit Starface Telefonanlage</Description>
|
||||
<Copyright>Stefan Hacker - HackerSoft</Copyright>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace StarfaceOutlookSync.UI
|
||||
|
||||
var lblVersion = new Label
|
||||
{
|
||||
Text = "Version 0.0.0.19",
|
||||
Text = "Version 0.0.0.22",
|
||||
Left = 0, Top = 56, Width = 340, Height = 20,
|
||||
TextAlign = ContentAlignment.MiddleCenter,
|
||||
ForeColor = Color.Gray
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace StarfaceOutlookSync.UI
|
||||
private StatusStrip _statusBar;
|
||||
private ToolStripStatusLabel _statusLabel;
|
||||
private Timer _autoSyncTimer;
|
||||
private volatile bool _syncRunning = false;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
@@ -30,14 +31,31 @@ namespace StarfaceOutlookSync.UI
|
||||
SetupAutoSync();
|
||||
RefreshProfileList();
|
||||
|
||||
// Minimiert starten falls in Einstellungen aktiviert
|
||||
// Einstellungen laden und anwenden
|
||||
var settings = UserSettings.Load();
|
||||
settings.ApplyOutlookSecuritySetting();
|
||||
|
||||
if (settings.StartMinimized)
|
||||
{
|
||||
WindowState = FormWindowState.Minimized;
|
||||
ShowInTaskbar = false;
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
// Beim Start automatisch synchronisieren
|
||||
if (settings.SyncOnStart)
|
||||
{
|
||||
_ = SyncAllProfiles();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SyncAllProfiles()
|
||||
{
|
||||
var profiles = _profileManager.GetProfiles().Where(p => p.Enabled).ToList();
|
||||
foreach (var profile in profiles)
|
||||
{
|
||||
await RunSync(profile);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetVisibleCore(bool value)
|
||||
@@ -58,8 +76,8 @@ namespace StarfaceOutlookSync.UI
|
||||
private void InitializeComponent()
|
||||
{
|
||||
Text = "Starface Kontakt-Sync";
|
||||
Size = new Size(620, 450);
|
||||
MinimumSize = new Size(500, 350);
|
||||
Size = new Size(830, 450);
|
||||
MinimumSize = new Size(830, 350);
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Font = new Font("Segoe UI", 9);
|
||||
Icon = AppIcon.GetIcon();
|
||||
@@ -158,6 +176,7 @@ namespace StarfaceOutlookSync.UI
|
||||
if (profiles.Any(p => p.Enabled))
|
||||
_trayMenu.Items.Add("-");
|
||||
|
||||
_trayMenu.Items.Add("Ueber", null, (s, e) => ShowAbout());
|
||||
_trayMenu.Items.Add("Beenden", null, (s, e) => ExitApplication());
|
||||
}
|
||||
|
||||
@@ -318,6 +337,13 @@ namespace StarfaceOutlookSync.UI
|
||||
|
||||
private async Task RunSync(SyncProfile profile)
|
||||
{
|
||||
if (_syncRunning)
|
||||
{
|
||||
SetStatus("Sync laeuft bereits, bitte warten...");
|
||||
return;
|
||||
}
|
||||
|
||||
_syncRunning = true;
|
||||
try
|
||||
{
|
||||
SetStatus($"Synchronisiere '{profile.Name}'...");
|
||||
@@ -340,6 +366,10 @@ namespace StarfaceOutlookSync.UI
|
||||
ex.Message, ToolTipIcon.Error);
|
||||
SetStatus($"Fehler: {ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
_syncRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetStatus(string text)
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace StarfaceOutlookSync.UI
|
||||
{
|
||||
public class SettingsForm : Form
|
||||
{
|
||||
private CheckBox _chkStartMinimized;
|
||||
private CheckBox _chkStartMinimized, _chkSyncOnStart, _chkAutoAcceptOutlook;
|
||||
private Button _btnSave, _btnCancel;
|
||||
private readonly UserSettings _settings;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace StarfaceOutlookSync.UI
|
||||
private void InitializeComponent()
|
||||
{
|
||||
Text = "Einstellungen";
|
||||
Size = new Size(350, 180);
|
||||
Size = new Size(380, 250);
|
||||
FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
MaximizeBox = false;
|
||||
MinimizeBox = false;
|
||||
@@ -33,20 +33,43 @@ namespace StarfaceOutlookSync.UI
|
||||
Checked = _settings.StartMinimized
|
||||
};
|
||||
|
||||
_chkSyncOnStart = new CheckBox
|
||||
{
|
||||
Text = "Beim Start automatisch synchronisieren",
|
||||
Left = 20, Top = 52, AutoSize = true,
|
||||
Checked = _settings.SyncOnStart
|
||||
};
|
||||
|
||||
_chkAutoAcceptOutlook = new CheckBox
|
||||
{
|
||||
Text = "Outlook-Sicherheitsabfrage automatisch erlauben",
|
||||
Left = 20, Top = 80, AutoSize = true,
|
||||
Checked = _settings.AutoAcceptOutlookPrompt
|
||||
};
|
||||
|
||||
var lblHint = new Label
|
||||
{
|
||||
Text = "Hinweis: Outlook muss nach Aenderung dieser Option\nneu gestartet werden.",
|
||||
Left = 38, Top = 102, Width = 300, Height = 32,
|
||||
ForeColor = Color.Gray,
|
||||
Font = new Font("Segoe UI", 8)
|
||||
};
|
||||
|
||||
_btnSave = new Button
|
||||
{
|
||||
Text = "Speichern", Left = 80, Top = 100, Width = 85, Height = 28,
|
||||
Text = "Speichern", Left = 95, Top = 170, Width = 85, Height = 28,
|
||||
DialogResult = DialogResult.None
|
||||
};
|
||||
_btnSave.Click += (s, e) => Save();
|
||||
|
||||
_btnCancel = new Button
|
||||
{
|
||||
Text = "Abbrechen", Left = 174, Top = 100, Width = 85, Height = 28,
|
||||
Text = "Abbrechen", Left = 189, Top = 170, Width = 85, Height = 28,
|
||||
DialogResult = DialogResult.Cancel
|
||||
};
|
||||
|
||||
Controls.AddRange(new Control[] { _chkStartMinimized, _btnSave, _btnCancel });
|
||||
Size = new Size(380, 260);
|
||||
Controls.AddRange(new Control[] { _chkStartMinimized, _chkSyncOnStart, _chkAutoAcceptOutlook, lblHint, _btnSave, _btnCancel });
|
||||
AcceptButton = _btnSave;
|
||||
CancelButton = _btnCancel;
|
||||
}
|
||||
@@ -54,6 +77,8 @@ namespace StarfaceOutlookSync.UI
|
||||
private void Save()
|
||||
{
|
||||
_settings.StartMinimized = _chkStartMinimized.Checked;
|
||||
_settings.SyncOnStart = _chkSyncOnStart.Checked;
|
||||
_settings.AutoAcceptOutlookPrompt = _chkAutoAcceptOutlook.Checked;
|
||||
_settings.Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
|
||||
Reference in New Issue
Block a user