From 3a06d5ee6a822d1f196929b39b10fa6ca6012369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 29 Jul 2004 20:39:38 +0000 Subject: [PATCH] added -r option git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8516 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/bin/keymap/Keymap.cpp | 18 ++++++++++++++---- src/apps/bin/keymap/Keymap.h | 2 +- src/apps/bin/keymap/key_map.cpp | 6 +++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/apps/bin/keymap/Keymap.cpp b/src/apps/bin/keymap/Keymap.cpp index 9bbb49477d..70a4184de4 100644 --- a/src/apps/bin/keymap/Keymap.cpp +++ b/src/apps/bin/keymap/Keymap.cpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include void Keymap::GetKey( char *chars, int32 offset, char* string) @@ -538,9 +540,17 @@ Keymap::GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** c status_t _restore_key_map_(); -// we make our input server use the map in /boot/home/config/settings/Keymap -status_t -Keymap::Use() +void +Keymap::RestoreSystemDefault() { - return _restore_key_map_(); + BPath path; + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path)!=B_OK) + return; + + path.Append("Key_map"); + + BEntry ref(path.Path()); + ref.Remove(); + + _restore_key_map_(); } diff --git a/src/apps/bin/keymap/Keymap.h b/src/apps/bin/keymap/Keymap.h index 71c3e8a8ac..13db980ab5 100644 --- a/src/apps/bin/keymap/Keymap.h +++ b/src/apps/bin/keymap/Keymap.h @@ -31,7 +31,7 @@ public: uint8 IsDeadKey(uint32 keyCode, uint32 modifiers); bool IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey); void GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** chars, int32* numBytes); - status_t Use(); + void RestoreSystemDefault(); static void GetKey( char *chars, int32 offset, char* string); private: char *fChars; diff --git a/src/apps/bin/keymap/key_map.cpp b/src/apps/bin/keymap/key_map.cpp index a3a4bf7a79..4b53fe0d04 100644 --- a/src/apps/bin/keymap/key_map.cpp +++ b/src/apps/bin/keymap/key_map.cpp @@ -42,10 +42,14 @@ int main(int argc, char **argv) keymap.LoadCurrent(); keymap.Dump(); return 0; + } + if (operation == 'r') { + Keymap keymap; + keymap.RestoreSystemDefault(); + return 0; } } else { if (operation == 'o') { - //return do_compile(argv[i]); return 0; } else break;