From aac2df0f0da3bc61f61de2b752351acdc1a664de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 21 Mar 2009 21:20:20 +0000 Subject: [PATCH] The enabling/disabling of applications flags is now properly tracked and the new BAppFileInfo feature to remove those flags is used to actually store this according to what the user configured. If this discrepancy was the only reason for ticket #3002, then it should be fixed now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29638 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../filetypes/ApplicationTypeWindow.cpp | 31 +++++++++++++------ .../filetypes/ApplicationTypeWindow.h | 3 +- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/preferences/filetypes/ApplicationTypeWindow.cpp b/src/preferences/filetypes/ApplicationTypeWindow.cpp index 5eedbd6cbb..c3b11e7ce9 100644 --- a/src/preferences/filetypes/ApplicationTypeWindow.cpp +++ b/src/preferences/filetypes/ApplicationTypeWindow.cpp @@ -700,7 +700,8 @@ ApplicationTypeWindow::_SetTo(const BEntry& entry) // store original data fOriginalInfo.signature = signature; - fOriginalInfo.flags = flags; + fOriginalInfo.gotFlags = gotFlags; + fOriginalInfo.flags = gotFlags ? flags : 0; fOriginalInfo.versionInfo = versionInfo; fOriginalInfo.supportedTypes = _SupportedTypes(); // The list view has the types sorted possibly differently @@ -756,15 +757,20 @@ ApplicationTypeWindow::_Save() // Retrieve Info - uint32 flags = _Flags(); + uint32 flags = 0; + bool gotFlags = _Flags(flags); BMessage supportedTypes = _SupportedTypes(); version_info versionInfo = _VersionInfo(); // Save status = info.SetSignature(fSignatureControl->Text()); - if (status == B_OK) - status = info.SetAppFlags(flags); + if (status == B_OK) { + if (gotFlags) + status = info.SetAppFlags(flags); + else + status = info.RemoveAppFlags(); + } if (status == B_OK) status = info.SetVersionInfo(&versionInfo, B_APP_VERSION_KIND); if (status == B_OK) @@ -784,6 +790,7 @@ ApplicationTypeWindow::_Save() // reset the saved info fOriginalInfo.signature = fSignatureControl->Text(); + fOriginalInfo.gotFlags = gotFlags; fOriginalInfo.flags = flags; fOriginalInfo.versionInfo = versionInfo; fOriginalInfo.supportedTypes = supportedTypes; @@ -825,9 +832,12 @@ ApplicationTypeWindow::_NeedsSaving(uint32 _flags) const } if (_flags & CHECK_FLAGS) { - if (fOriginalInfo.flags != _Flags()) + uint32 appFlags = 0; + bool gotFlags = _Flags(appFlags); + if (fOriginalInfo.gotFlags != gotFlags + || fOriginalInfo.flags != appFlags) { flags |= CHECK_FLAGS; - else + } else flags &= ~CHECK_FLAGS; } @@ -866,10 +876,10 @@ ApplicationTypeWindow::_NeedsSaving(uint32 _flags) const // #pragma mark - -uint32 -ApplicationTypeWindow::_Flags() const +bool +ApplicationTypeWindow::_Flags(uint32& flags) const { - uint32 flags = 0; + flags = 0; if (fFlagsCheckBox->Value() != B_CONTROL_OFF) { if (fSingleLaunchButton->Value() != B_CONTROL_OFF) flags |= B_SINGLE_LAUNCH; @@ -882,8 +892,9 @@ ApplicationTypeWindow::_Flags() const flags |= B_ARGV_ONLY; if (fBackgroundAppCheckBox->Value() != B_CONTROL_OFF) flags |= B_BACKGROUND_APP; + return true; } - return flags; + return false; } diff --git a/src/preferences/filetypes/ApplicationTypeWindow.h b/src/preferences/filetypes/ApplicationTypeWindow.h index 11ab5155ed..5beb43650b 100644 --- a/src/preferences/filetypes/ApplicationTypeWindow.h +++ b/src/preferences/filetypes/ApplicationTypeWindow.h @@ -40,7 +40,7 @@ class ApplicationTypeWindow : public BWindow { void _MakeNumberTextControl(BTextControl* control); void _Save(); - uint32 _Flags() const; + bool _Flags(uint32& flags) const; BMessage _SupportedTypes() const; version_info _VersionInfo() const; @@ -50,6 +50,7 @@ class ApplicationTypeWindow : public BWindow { private: struct AppInfo { BString signature; + bool gotFlags; uint32 flags; version_info versionInfo;