diff --git a/Assets.xcassets/Accounts.dataset/Accounts.tiff b/Assets.xcassets/Accounts.dataset/Accounts.tiff deleted file mode 100644 index 246a7aa8..00000000 Binary files a/Assets.xcassets/Accounts.dataset/Accounts.tiff and /dev/null differ diff --git a/Assets.xcassets/Accounts.dataset/Contents.json b/Assets.xcassets/Accounts.dataset/Contents.json deleted file mode 100644 index 6ba4bda0..00000000 --- a/Assets.xcassets/Accounts.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "Accounts.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/Accounts.imageset/Accounts.png b/Assets.xcassets/Accounts.imageset/Accounts.png new file mode 100644 index 00000000..2b54a29b Binary files /dev/null and b/Assets.xcassets/Accounts.imageset/Accounts.png differ diff --git a/Assets.xcassets/Accounts.imageset/Accounts_dark.png b/Assets.xcassets/Accounts.imageset/Accounts_dark.png new file mode 100644 index 00000000..7616e989 Binary files /dev/null and b/Assets.xcassets/Accounts.imageset/Accounts_dark.png differ diff --git a/Assets.xcassets/Accounts.imageset/Contents.json b/Assets.xcassets/Accounts.imageset/Contents.json new file mode 100644 index 00000000..f7e926a9 --- /dev/null +++ b/Assets.xcassets/Accounts.imageset/Contents.json @@ -0,0 +1,52 @@ +{ + "images" : [ + { + "filename" : "Accounts.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "Accounts_dark.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/Banlist.imageset/Contents.json b/Assets.xcassets/Banlist.imageset/Contents.json index 49c606a2..52e7521b 100644 --- a/Assets.xcassets/Banlist.imageset/Contents.json +++ b/Assets.xcassets/Banlist.imageset/Contents.json @@ -1,8 +1,8 @@ { "images" : [ { - "idiom" : "universal", "filename" : "Banlist.png", + "idiom" : "universal", "scale" : "1x" }, { @@ -15,7 +15,7 @@ } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Assets.xcassets/Boards.imageset/Contents.json b/Assets.xcassets/Boards.imageset/Contents.json index 73c5ce30..8b93063a 100644 --- a/Assets.xcassets/Boards.imageset/Contents.json +++ b/Assets.xcassets/Boards.imageset/Contents.json @@ -1,8 +1,8 @@ { "images" : [ { - "idiom" : "universal", "filename" : "Boards.png", + "idiom" : "universal", "scale" : "1x" }, { @@ -15,7 +15,7 @@ } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Assets.xcassets/Bookmarks.dataset/Bookmarks.tiff b/Assets.xcassets/Bookmarks.dataset/Bookmarks.tiff deleted file mode 100644 index 3c566502..00000000 Binary files a/Assets.xcassets/Bookmarks.dataset/Bookmarks.tiff and /dev/null differ diff --git a/Assets.xcassets/Bookmarks.dataset/Contents.json b/Assets.xcassets/Bookmarks.dataset/Contents.json deleted file mode 100644 index f749a085..00000000 --- a/Assets.xcassets/Bookmarks.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "Bookmarks.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/Bookmarks.imageset/Bookmarks.png b/Assets.xcassets/Bookmarks.imageset/Bookmarks.png new file mode 100644 index 00000000..f0be14e8 Binary files /dev/null and b/Assets.xcassets/Bookmarks.imageset/Bookmarks.png differ diff --git a/Assets.xcassets/Bookmarks.imageset/Contents.json b/Assets.xcassets/Bookmarks.imageset/Contents.json new file mode 100644 index 00000000..5ccdea2b --- /dev/null +++ b/Assets.xcassets/Bookmarks.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Bookmarks.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/BookmarksSmall.dataset/BookmarksSmall.tiff b/Assets.xcassets/BookmarksSmall.dataset/BookmarksSmall.tiff deleted file mode 100644 index ce9a973c..00000000 Binary files a/Assets.xcassets/BookmarksSmall.dataset/BookmarksSmall.tiff and /dev/null differ diff --git a/Assets.xcassets/BookmarksSmall.dataset/Contents.json b/Assets.xcassets/BookmarksSmall.dataset/Contents.json deleted file mode 100644 index 54296483..00000000 --- a/Assets.xcassets/BookmarksSmall.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "BookmarksSmall.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/BookmarksSmall.imageset/BookmarksSmall.png b/Assets.xcassets/BookmarksSmall.imageset/BookmarksSmall.png new file mode 100644 index 00000000..a454476b Binary files /dev/null and b/Assets.xcassets/BookmarksSmall.imageset/BookmarksSmall.png differ diff --git a/Assets.xcassets/BookmarksSmall.imageset/Contents.json b/Assets.xcassets/BookmarksSmall.imageset/Contents.json new file mode 100644 index 00000000..0e654091 --- /dev/null +++ b/Assets.xcassets/BookmarksSmall.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "BookmarksSmall.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/BookmarksSmallConnected.dataset/Contents.json b/Assets.xcassets/BookmarksSmallConnected.dataset/Contents.json deleted file mode 100644 index b14238bd..00000000 --- a/Assets.xcassets/BookmarksSmallConnected.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "BookmarksSmallConnected.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/BookmarksSmallConnected.imageset/BookmarksSmallConnected.png b/Assets.xcassets/BookmarksSmallConnected.imageset/BookmarksSmallConnected.png new file mode 100644 index 00000000..4b9f9666 Binary files /dev/null and b/Assets.xcassets/BookmarksSmallConnected.imageset/BookmarksSmallConnected.png differ diff --git a/Assets.xcassets/BookmarksSmallConnected.imageset/Contents.json b/Assets.xcassets/BookmarksSmallConnected.imageset/Contents.json new file mode 100644 index 00000000..7730601b --- /dev/null +++ b/Assets.xcassets/BookmarksSmallConnected.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "BookmarksSmallConnected.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/BookmarksSmallDisconnected.dataset/BookmarksSmallDisconnected.tiff b/Assets.xcassets/BookmarksSmallDisconnected.dataset/BookmarksSmallDisconnected.tiff deleted file mode 100644 index 514ec8b0..00000000 Binary files a/Assets.xcassets/BookmarksSmallDisconnected.dataset/BookmarksSmallDisconnected.tiff and /dev/null differ diff --git a/Assets.xcassets/BookmarksSmallDisconnected.dataset/Contents.json b/Assets.xcassets/BookmarksSmallDisconnected.dataset/Contents.json deleted file mode 100644 index 53ea8b08..00000000 --- a/Assets.xcassets/BookmarksSmallDisconnected.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "BookmarksSmallDisconnected.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/BookmarksSmallDisconnected.imageset/BookmarksSmallDisconnected.png b/Assets.xcassets/BookmarksSmallDisconnected.imageset/BookmarksSmallDisconnected.png new file mode 100644 index 00000000..d438c4bf Binary files /dev/null and b/Assets.xcassets/BookmarksSmallDisconnected.imageset/BookmarksSmallDisconnected.png differ diff --git a/Assets.xcassets/BookmarksSmallDisconnected.imageset/Contents.json b/Assets.xcassets/BookmarksSmallDisconnected.imageset/Contents.json new file mode 100644 index 00000000..dbef9521 --- /dev/null +++ b/Assets.xcassets/BookmarksSmallDisconnected.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "BookmarksSmallDisconnected.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/Chat History.imageset/Contents.json b/Assets.xcassets/Chat History.imageset/Contents.json index a169f942..dd558da7 100644 --- a/Assets.xcassets/Chat History.imageset/Contents.json +++ b/Assets.xcassets/Chat History.imageset/Contents.json @@ -1,8 +1,8 @@ { "images" : [ { - "idiom" : "universal", "filename" : "Chat History.png", + "idiom" : "universal", "scale" : "1x" }, { @@ -15,7 +15,7 @@ } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Assets.xcassets/ClearChat.imageset/Contents.json b/Assets.xcassets/ClearChat.imageset/Contents.json index bb6eafa8..429cb7e6 100644 --- a/Assets.xcassets/ClearChat.imageset/Contents.json +++ b/Assets.xcassets/ClearChat.imageset/Contents.json @@ -1,8 +1,8 @@ { "images" : [ { - "idiom" : "universal", "filename" : "ClearChat.png", + "idiom" : "universal", "scale" : "1x" }, { @@ -15,7 +15,7 @@ } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Assets.xcassets/Connect.dataset/Connect.tiff b/Assets.xcassets/Connect.dataset/Connect.tiff deleted file mode 100644 index 30cf1d34..00000000 Binary files a/Assets.xcassets/Connect.dataset/Connect.tiff and /dev/null differ diff --git a/Assets.xcassets/Connect.dataset/Contents.json b/Assets.xcassets/Connect.dataset/Contents.json deleted file mode 100644 index c0aa1e28..00000000 --- a/Assets.xcassets/Connect.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "Connect.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/Connect.imageset/Connect.png b/Assets.xcassets/Connect.imageset/Connect.png new file mode 100644 index 00000000..9610f94c Binary files /dev/null and b/Assets.xcassets/Connect.imageset/Connect.png differ diff --git a/Assets.xcassets/Connect.imageset/Contents.json b/Assets.xcassets/Connect.imageset/Contents.json new file mode 100644 index 00000000..4167db07 --- /dev/null +++ b/Assets.xcassets/Connect.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Connect.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/Events.dataset/Contents.json b/Assets.xcassets/Events.dataset/Contents.json deleted file mode 100644 index 3b6f8bf8..00000000 --- a/Assets.xcassets/Events.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "Events.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/Events.dataset/Events.tiff b/Assets.xcassets/Events.dataset/Events.tiff deleted file mode 100644 index 10e31498..00000000 Binary files a/Assets.xcassets/Events.dataset/Events.tiff and /dev/null differ diff --git a/Assets.xcassets/Events.imageset/Contents.json b/Assets.xcassets/Events.imageset/Contents.json new file mode 100644 index 00000000..aebf7593 --- /dev/null +++ b/Assets.xcassets/Events.imageset/Contents.json @@ -0,0 +1,52 @@ +{ + "images" : [ + { + "filename" : "Events.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "Events_dark.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/Events.imageset/Events.png b/Assets.xcassets/Events.imageset/Events.png new file mode 100644 index 00000000..61798dbd Binary files /dev/null and b/Assets.xcassets/Events.imageset/Events.png differ diff --git a/Assets.xcassets/Events.imageset/Events_dark.png b/Assets.xcassets/Events.imageset/Events_dark.png new file mode 100644 index 00000000..18547147 Binary files /dev/null and b/Assets.xcassets/Events.imageset/Events_dark.png differ diff --git a/Assets.xcassets/LabelWhite.dataset/Contents.json b/Assets.xcassets/LabelWhite.dataset/Contents.json new file mode 100644 index 00000000..5c8ab266 --- /dev/null +++ b/Assets.xcassets/LabelWhite.dataset/Contents.json @@ -0,0 +1,13 @@ +{ + "data" : [ + { + "filename" : "LabelWhite.tiff", + "idiom" : "universal", + "universal-type-identifier" : "public.tiff" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/BookmarksSmallConnected.dataset/BookmarksSmallConnected.tiff b/Assets.xcassets/LabelWhite.dataset/LabelWhite.tiff similarity index 71% rename from Assets.xcassets/BookmarksSmallConnected.dataset/BookmarksSmallConnected.tiff rename to Assets.xcassets/LabelWhite.dataset/LabelWhite.tiff index 5ab924c4..a9c69a17 100644 Binary files a/Assets.xcassets/BookmarksSmallConnected.dataset/BookmarksSmallConnected.tiff and b/Assets.xcassets/LabelWhite.dataset/LabelWhite.tiff differ diff --git a/Assets.xcassets/Log.dataset/Contents.json b/Assets.xcassets/Log.dataset/Contents.json deleted file mode 100644 index 21676778..00000000 --- a/Assets.xcassets/Log.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "Log.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/Log.dataset/Log.tiff b/Assets.xcassets/Log.dataset/Log.tiff deleted file mode 100644 index 9d228285..00000000 Binary files a/Assets.xcassets/Log.dataset/Log.tiff and /dev/null differ diff --git a/Assets.xcassets/Log.imageset/Contents.json b/Assets.xcassets/Log.imageset/Contents.json new file mode 100644 index 00000000..8df381a4 --- /dev/null +++ b/Assets.xcassets/Log.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Log.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/Log.imageset/Log.png b/Assets.xcassets/Log.imageset/Log.png new file mode 100644 index 00000000..0ea3bf4b Binary files /dev/null and b/Assets.xcassets/Log.imageset/Log.png differ diff --git a/Assets.xcassets/Messages.dataset/Contents.json b/Assets.xcassets/Messages.dataset/Contents.json deleted file mode 100644 index 3176d6b2..00000000 --- a/Assets.xcassets/Messages.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "Messages.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/Messages.dataset/Messages.tiff b/Assets.xcassets/Messages.dataset/Messages.tiff deleted file mode 100644 index 07135e5d..00000000 Binary files a/Assets.xcassets/Messages.dataset/Messages.tiff and /dev/null differ diff --git a/Assets.xcassets/Messages.imageset/Contents.json b/Assets.xcassets/Messages.imageset/Contents.json new file mode 100644 index 00000000..ebd9c9c7 --- /dev/null +++ b/Assets.xcassets/Messages.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Messages.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/Messages.imageset/Messages.png b/Assets.xcassets/Messages.imageset/Messages.png new file mode 100644 index 00000000..26973037 Binary files /dev/null and b/Assets.xcassets/Messages.imageset/Messages.png differ diff --git a/Assets.xcassets/Monitor.dataset/Contents.json b/Assets.xcassets/Monitor.dataset/Contents.json deleted file mode 100644 index 61b61cfb..00000000 --- a/Assets.xcassets/Monitor.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "Monitor.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/Monitor.dataset/Monitor.tiff b/Assets.xcassets/Monitor.dataset/Monitor.tiff deleted file mode 100644 index 382c752b..00000000 Binary files a/Assets.xcassets/Monitor.dataset/Monitor.tiff and /dev/null differ diff --git a/Assets.xcassets/Monitor.imageset/Contents.json b/Assets.xcassets/Monitor.imageset/Contents.json new file mode 100644 index 00000000..62eb0680 --- /dev/null +++ b/Assets.xcassets/Monitor.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Monitor.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/Monitor.imageset/Monitor.png b/Assets.xcassets/Monitor.imageset/Monitor.png new file mode 100644 index 00000000..b734629a Binary files /dev/null and b/Assets.xcassets/Monitor.imageset/Monitor.png differ diff --git a/Assets.xcassets/NowPlaying.imageset/Contents.json b/Assets.xcassets/NowPlaying.imageset/Contents.json index 5f541703..7edbf7c5 100644 --- a/Assets.xcassets/NowPlaying.imageset/Contents.json +++ b/Assets.xcassets/NowPlaying.imageset/Contents.json @@ -1,8 +1,8 @@ { "images" : [ { - "idiom" : "universal", "filename" : "NowPlaying.png", + "idiom" : "universal", "scale" : "1x" }, { @@ -15,7 +15,7 @@ } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Assets.xcassets/NowPlaying.imageset/NowPlaying.png b/Assets.xcassets/NowPlaying.imageset/NowPlaying.png index a68555db..e104e73f 100644 Binary files a/Assets.xcassets/NowPlaying.imageset/NowPlaying.png and b/Assets.xcassets/NowPlaying.imageset/NowPlaying.png differ diff --git a/Assets.xcassets/Reconnect.dataset/Contents.json b/Assets.xcassets/Reconnect.dataset/Contents.json deleted file mode 100644 index e2ddfc25..00000000 --- a/Assets.xcassets/Reconnect.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "Reconnect.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/Reconnect.dataset/Reconnect.tiff b/Assets.xcassets/Reconnect.dataset/Reconnect.tiff deleted file mode 100644 index 30cf1d34..00000000 Binary files a/Assets.xcassets/Reconnect.dataset/Reconnect.tiff and /dev/null differ diff --git a/Assets.xcassets/Reconnect.imageset/Contents.json b/Assets.xcassets/Reconnect.imageset/Contents.json new file mode 100644 index 00000000..1843b15e --- /dev/null +++ b/Assets.xcassets/Reconnect.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Reconnect.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/Reconnect.imageset/Reconnect.png b/Assets.xcassets/Reconnect.imageset/Reconnect.png new file mode 100644 index 00000000..9610f94c Binary files /dev/null and b/Assets.xcassets/Reconnect.imageset/Reconnect.png differ diff --git a/Assets.xcassets/Settings.imageset/Contents.json b/Assets.xcassets/Settings.imageset/Contents.json index 9ff11907..88cd877e 100644 --- a/Assets.xcassets/Settings.imageset/Contents.json +++ b/Assets.xcassets/Settings.imageset/Contents.json @@ -1,8 +1,8 @@ { "images" : [ { - "idiom" : "universal", "filename" : "Settings.png", + "idiom" : "universal", "scale" : "1x" }, { @@ -15,7 +15,7 @@ } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Assets.xcassets/Transfers.dataset/Contents.json b/Assets.xcassets/Transfers.dataset/Contents.json deleted file mode 100644 index 15a60af4..00000000 --- a/Assets.xcassets/Transfers.dataset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "data" : [ - { - "idiom" : "universal", - "filename" : "Transfers.tiff" - } - ] -} \ No newline at end of file diff --git a/Assets.xcassets/Transfers.dataset/Transfers.tiff b/Assets.xcassets/Transfers.dataset/Transfers.tiff deleted file mode 100644 index d26ed5f7..00000000 Binary files a/Assets.xcassets/Transfers.dataset/Transfers.tiff and /dev/null differ diff --git a/Assets.xcassets/Transfers.imageset/Contents.json b/Assets.xcassets/Transfers.imageset/Contents.json new file mode 100644 index 00000000..2b5f5392 --- /dev/null +++ b/Assets.xcassets/Transfers.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Transfers.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assets.xcassets/Transfers.imageset/Transfers.png b/Assets.xcassets/Transfers.imageset/Transfers.png new file mode 100644 index 00000000..335e53e2 Binary files /dev/null and b/Assets.xcassets/Transfers.imageset/Transfers.png differ diff --git a/Sources/WCAccountsController.h b/Sources/WCAccountsController.h index 44c86d93..bba40bee 100644 --- a/Sources/WCAccountsController.h +++ b/Sources/WCAccountsController.h @@ -80,6 +80,8 @@ extern NSString * const WCAccountsControllerAccountsDidChangeNotification; IBOutlet WIOutlineView *_settingsOutlineView; IBOutlet NSTableColumn *_settingTableColumn; IBOutlet NSTableColumn *_valueTableColumn; + + NSPopUpButtonCell *_popUpButtonCell; NSArray *_allSettings; NSMutableArray *_shownSettings; diff --git a/Sources/WCAccountsController.m b/Sources/WCAccountsController.m index 7ad941d3..11baf769 100644 --- a/Sources/WCAccountsController.m +++ b/Sources/WCAccountsController.m @@ -33,20 +33,20 @@ #import "WCServerConnection.h" #import "WCUser.h" -#define WCAccountsFieldCell @"WCAccountsFieldCell" -#define WCAccountsFieldSettings @"WCAccountsFieldSettings" +#define WCAccountsFieldCell @"WCAccountsFieldCell" +#define WCAccountsFieldSettings @"WCAccountsFieldSettings" -NSString * const WCAccountsControllerAccountsDidChangeNotification = @"WCAccountsControllerAccountsDidChangeNotification"; +NSString * const WCAccountsControllerAccountsDidChangeNotification = @"WCAccountsControllerAccountsDidChangeNotification"; enum _WCAccountsAction { - WCAccountsDoNothing, - WCAccountsCloseWindow, - WCAccountsSelectTab, - WCAccountsSelectRow + WCAccountsDoNothing, + WCAccountsCloseWindow, + WCAccountsSelectTab, + WCAccountsSelectRow }; -typedef enum _WCAccountsAction WCAccountsAction; +typedef enum _WCAccountsAction WCAccountsAction; @interface WCAccountsController(Private) @@ -84,180 +84,211 @@ - (void)_selectAccounts; @implementation WCAccountsController(Private) - (void)_validate { - WCAccount *account; - BOOL save = NO; + WCAccount *account; + BOOL save = NO; - [_addButton setEnabled:[self _validateAddAccount]]; - [_deleteButton setEnabled:[self _validateDeleteAccount]]; + [_addButton setEnabled:[self _validateAddAccount]]; + [_deleteButton setEnabled:[self _validateDeleteAccount]]; - if(_touched && [[_administration connection] isConnected]) { - account = [[_administration connection] account]; - - if(_creating && ([account accountCreateUsers] || [account accountCreateGroups])) - save = YES; - else if(_editing && ([account accountEditUsers] || [account accountEditGroups])) - save = YES; - } + if(_touched && [[_administration connection] isConnected]) { + account = [[_administration connection] account]; + + if(_creating && ([account accountCreateUsers] || [account accountCreateGroups])) + save = YES; + else if(_editing && ([account accountEditUsers] || [account accountEditGroups])) + save = YES; + } - [_saveButton setEnabled:save]; + [_saveButton setEnabled:save]; } - (BOOL)_validateAddAccount { - WCAccount *account; - - if(![_administration connection] || ![[_administration connection] isConnected]) - return NO; - - account = [[_administration connection] account]; + WCAccount *account; + + if(![_administration connection] || ![[_administration connection] isConnected]) + return NO; + + account = [[_administration connection] account]; - return ([account accountCreateUsers] || [account accountCreateGroups]); + return ([account accountCreateUsers] || [account accountCreateGroups]); } - (BOOL)_validateDeleteAccount { - NSEnumerator *enumerator; - NSArray *accounts; - WCAccount *account, *selectedAccount; - - if(![_administration connection] || ![[_administration connection] isConnected]) - return NO; - - accounts = [self _selectedAccounts]; - - if([accounts count] == 0) - return NO; - - account = [[_administration connection] account]; - - if([account accountDeleteUsers] && [account accountDeleteGroups]) - return YES; - - if([account accountDeleteUsers] || [account accountDeleteGroups]) { - enumerator = [accounts objectEnumerator]; - - while((selectedAccount = [enumerator nextObject])) { - if([selectedAccount isKindOfClass:[WCUserAccount class]] && ![account accountDeleteUsers]) - return NO; - else if([selectedAccount isKindOfClass:[WCGroupAccount class]] && ![account accountDeleteGroups]) - return NO; - } - - return YES; - } - - return NO; + NSEnumerator *enumerator; + NSArray *accounts; + WCAccount *account, *selectedAccount; + + if(![_administration connection] || ![[_administration connection] isConnected]) + return NO; + + accounts = [self _selectedAccounts]; + + if([accounts count] == 0) + return NO; + + account = [[_administration connection] account]; + + if([account accountDeleteUsers] && [account accountDeleteGroups]) + return YES; + + if([account accountDeleteUsers] || [account accountDeleteGroups]) { + enumerator = [accounts objectEnumerator]; + + while((selectedAccount = [enumerator nextObject])) { + if([selectedAccount isKindOfClass:[WCUserAccount class]] && ![account accountDeleteUsers]) + return NO; + else if([selectedAccount isKindOfClass:[WCGroupAccount class]] && ![account accountDeleteGroups]) + return NO; + } + + return YES; + } + + return NO; } - (BOOL)_validateDuplicateAccount { - NSArray *accounts; - WCAccount *account; - - if(![_administration connection] || ![[_administration connection] isConnected]) - return NO; - - accounts = [self _selectedAccounts]; - - if([accounts count] != 1) - return NO; - - account = [[_administration connection] account]; - - if([[accounts objectAtIndex:0] isKindOfClass:[WCUserAccount class]]) - return [account accountCreateUsers]; - else - return [account accountCreateGroups]; + NSArray *accounts; + WCAccount *account; + + if(![_administration connection] || ![[_administration connection] isConnected]) + return NO; + + accounts = [self _selectedAccounts]; + + if([accounts count] != 1) + return NO; + + account = [[_administration connection] account]; + + if([[accounts objectAtIndex:0] isKindOfClass:[WCUserAccount class]]) + return [account accountCreateUsers]; + else + return [account accountCreateGroups]; } #pragma mark - - (void)_requestAccounts { - WIP7Message *message; - - if(!_requested && [[_administration connection] isConnected] && [[[_administration connection] account] accountListAccounts]) { - [_progressIndicator startAnimation:self]; + WIP7Message *message; + + if(!_requested && [[_administration connection] isConnected] && [[[_administration connection] account] accountListAccounts]) { + [_progressIndicator startAnimation:self]; - [_allAccounts removeAllObjects]; - [_allUserAccounts removeAllObjects]; - [_allGroupAccounts removeAllObjects]; - [_shownAccounts removeAllObjects]; + [_allAccounts removeAllObjects]; + [_allUserAccounts removeAllObjects]; + [_allGroupAccounts removeAllObjects]; + [_shownAccounts removeAllObjects]; - [_accountsTableView reloadData]; + [_accountsTableView reloadData]; - message = [WIP7Message messageWithName:@"wired.account.list_users" spec:WCP7Spec]; - [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountListAccountsReply:)]; + message = [WIP7Message messageWithName:@"wired.account.list_users" spec:WCP7Spec]; + [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountListAccountsReply:)]; - message = [WIP7Message messageWithName:@"wired.account.list_groups" spec:WCP7Spec]; - [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountListAccountsReply:)]; - - message = [WIP7Message messageWithName:@"wired.account.subscribe_accounts" spec:WCP7Spec]; - [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountSubscribeAccountsReply:)]; - - _requested = YES; - } + message = [WIP7Message messageWithName:@"wired.account.list_groups" spec:WCP7Spec]; + [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountListAccountsReply:)]; + + message = [WIP7Message messageWithName:@"wired.account.subscribe_accounts" spec:WCP7Spec]; + [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountSubscribeAccountsReply:)]; + + _requested = YES; + } } - (void)_reloadAccounts { - WIP7Message *message; - - if([[_administration connection] isConnected] && [[[_administration connection] account] accountListAccounts]) { - [_progressIndicator startAnimation:self]; - - [_allAccounts removeAllObjects]; - [_allUserAccounts removeAllObjects]; - [_allGroupAccounts removeAllObjects]; - [_shownAccounts removeAllObjects]; - - [_accountsTableView reloadData]; - - message = [WIP7Message messageWithName:@"wired.account.list_users" spec:WCP7Spec]; - [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountListAccountsReply:)]; - - message = [WIP7Message messageWithName:@"wired.account.list_groups" spec:WCP7Spec]; - [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountListAccountsReply:)]; - } + WIP7Message *message; + + if([[_administration connection] isConnected] && [[[_administration connection] account] accountListAccounts]) { + [_progressIndicator startAnimation:self]; + + [_allAccounts removeAllObjects]; + [_allUserAccounts removeAllObjects]; + [_allGroupAccounts removeAllObjects]; + [_shownAccounts removeAllObjects]; + + [_accountsTableView reloadData]; + + message = [WIP7Message messageWithName:@"wired.account.list_users" spec:WCP7Spec]; + [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountListAccountsReply:)]; + + message = [WIP7Message messageWithName:@"wired.account.list_groups" spec:WCP7Spec]; + [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountListAccountsReply:)]; + } +} + +- (void)_reloadColorsPopUpButtonMenu { + NSInteger selectedItemIndex; + NSString *imageName, *menuName; + + if (!_popUpButtonCell) + return; + + imageName = [NSApp darkModeEnabled] ? @"LabelWhite" : @"LabelBlack"; + menuName = [NSApp darkModeEnabled] ? @"White" : @"Black"; + selectedItemIndex = [_popUpButtonCell indexOfSelectedItem]; + + [_popUpButtonCell removeAllItems]; + + [_popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(menuName, @"Account color") + image:[NSImage imageNamed:imageName]]]; + [_popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Red", @"Account color") + image:[NSImage imageNamed:@"LabelRed"]]]; + [_popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Orange", @"Account color") + image:[NSImage imageNamed:@"LabelOrange"]]]; + [_popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Green", @"Account color") + image:[NSImage imageNamed:@"LabelGreen"]]]; + [_popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Blue", @"Account color") + image:[NSImage imageNamed:@"LabelBlue"]]]; + [_popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Purple", @"Account color") + image:[NSImage imageNamed:@"LabelPurple"]]]; + + if (selectedItemIndex != -1) + [_popUpButtonCell selectItemAtIndex:selectedItemIndex]; } + #pragma mark - - (NSDictionary *)_settingForRow:(NSInteger)row { - return [_shownSettings objectAtIndex:row]; + return [_shownSettings objectAtIndex:row]; } #pragma mark - - (BOOL)_verifyUnsavedAndPerformAction:(WCAccountsAction)action argument:(id)argument { - NSMutableDictionary *dictionary; - NSAlert *alert; - - if(_touched && !_saving) { - _saving = YES; - - dictionary = [[NSMutableDictionary alloc] init]; - - [dictionary setObject:[NSNumber numberWithInteger:action] forKey:@"WCAccountsAction"]; - - if(argument) - [dictionary setObject:argument forKey:@"WCAccountsArgument"]; - + NSMutableDictionary *dictionary; + NSAlert *alert; + + if(_touched && !_saving) { + _saving = YES; + + dictionary = [[NSMutableDictionary alloc] init]; + + [dictionary setObject:[NSNumber numberWithInteger:action] forKey:@"WCAccountsAction"]; + + if(argument) + [dictionary setObject:argument forKey:@"WCAccountsArgument"]; + alert = [[NSAlert alloc] init]; - if([_accounts count] == 1) { - [alert setMessageText:[NSSWF: - NSLS(@"Save changes to the \u201c%@\u201d account?", @"Save account dialog title (name)"), - [_nameTextField stringValue]]]; - } else { - [alert setMessageText:[NSSWF: - NSLS(@"Save changes to %u accounts?", @"Save account dialog title (count)"), - [_accounts count]]]; - } + if([_accounts count] == 1) { + [alert setMessageText:[NSSWF: + NSLS(@"Save changes to the \u201c%@\u201d account?", @"Save account dialog title (name)"), + [_nameTextField stringValue]]]; + } else { + [alert setMessageText:[NSSWF: + NSLS(@"Save changes to %u accounts?", @"Save account dialog title (count)"), + [_accounts count]]]; + } action = [[dictionary objectForKey:@"WCAccountsAction"] integerValue]; argument = [dictionary objectForKey:@"WCAccountsArgument"]; - [alert setInformativeText:NSLS(@"If you don't save the changes, they will be lost.", @"Save account dialog description")]; - [alert addButtonWithTitle:NSLS(@"Save", @"Save account dialog button")]; - [alert addButtonWithTitle:NSLS(@"Cancel", @"Save account dialog button")]; - [alert addButtonWithTitle:NSLS(@"Don't Save", @"Save account dialog button")]; + [alert setInformativeText:NSLS(@"If you don't save the changes, they will be lost.", @"Save account dialog description")]; + [alert addButtonWithTitle:NSLS(@"Save", @"Save account dialog button")]; + [alert addButtonWithTitle:NSLS(@"Cancel", @"Save account dialog button")]; + [alert addButtonWithTitle:NSLS(@"Don't Save", @"Save account dialog button")]; NSInteger returnCode = [alert runModal]; if(returnCode != NSAlertSecondButtonReturn) { if(returnCode == NSAlertFirstButtonReturn) { @@ -306,655 +337,655 @@ - (BOOL)_verifyUnsavedAndPerformAction:(WCAccountsAction)action argument:(id)arg } _saving = NO; return NO; - } + } - return YES; + return YES; } - (void)_save { - NSEnumerator *enumerator; - WCAccount *account; - BOOL reload = YES; - - _touched = NO; - - if(_creating) { - if([_typePopUpButton selectedItem] == _userMenuItem) - account = [WCUserAccount account]; - else - account = [WCGroupAccount account]; - - [account setValues:[[_accounts lastObject] values]]; - - [self _writeToAccounts:[NSArray arrayWithObject:account]]; - - [[_administration connection] sendMessage:[account createAccountMessage] - fromObserver:self - selector:@selector(wiredAccountChangeAccountReply:)]; - - [_selectAccounts setArray:[NSArray arrayWithObject:account]]; - - reload = NO; - } else { - [self _writeToAccounts:_accounts]; - - if([_accounts count] == 1) { - account = [_accounts lastObject]; - - [[_administration connection] sendMessage:[account editAccountMessage] - fromObserver:self - selector:@selector(wiredAccountChangeAccountReply:)]; - - if(![[account newName] isEqualToString:[account name]]) - reload = NO; - } else { - enumerator = [_accounts objectEnumerator]; - - while((account = [enumerator nextObject])) { + NSEnumerator *enumerator; + WCAccount *account; + BOOL reload = YES; + + _touched = NO; + + if(_creating) { + if([_typePopUpButton selectedItem] == _userMenuItem) + account = [WCUserAccount account]; + else + account = [WCGroupAccount account]; + + [account setValues:[[_accounts lastObject] values]]; + + [self _writeToAccounts:[NSArray arrayWithObject:account]]; + + [[_administration connection] sendMessage:[account createAccountMessage] + fromObserver:self + selector:@selector(wiredAccountChangeAccountReply:)]; + + [_selectAccounts setArray:[NSArray arrayWithObject:account]]; + + reload = NO; + } else { + [self _writeToAccounts:_accounts]; + + if([_accounts count] == 1) { + account = [_accounts lastObject]; + + [[_administration connection] sendMessage:[account editAccountMessage] + fromObserver:self + selector:@selector(wiredAccountChangeAccountReply:)]; + + if(![[account newName] isEqualToString:[account name]]) + reload = NO; + } else { + enumerator = [_accounts objectEnumerator]; + + while((account = [enumerator nextObject])) { - [[_administration connection] sendMessage:[account editAccountMessage] - fromObserver:self - selector:@selector(wiredAccountChangeAccountReply:)]; - } - } + [[_administration connection] sendMessage:[account editAccountMessage] + fromObserver:self + selector:@selector(wiredAccountChangeAccountReply:)]; + } + } - [_selectAccounts setArray:_accounts]; - } + [_selectAccounts setArray:_accounts]; + } } - (BOOL)_canEditAccounts { - NSEnumerator *enumerator; - WCAccount *account; - BOOL user, group, editable; - - user = NO; - group = NO; - enumerator = [_accounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - if([account isKindOfClass:[WCUserAccount class]] || (_creating && [_typePopUpButton selectedItem] == _userMenuItem)) - user = YES; - else if([account isKindOfClass:[WCGroupAccount class]] || (_creating && [_typePopUpButton selectedItem] == _groupMenuItem)) - group = YES; - } - - editable = YES; - account = [[_administration connection] account]; - - if(user) { - if(_creating && ![account accountCreateUsers]) - editable = NO; - else if(_editing && ![account accountEditUsers]) - editable = NO; - } - - if(group) { - if(_creating && ![account accountCreateGroups]) - editable = NO; - else if(_editing && ![account accountEditGroups]) - editable = NO; - } - - return editable; + NSEnumerator *enumerator; + WCAccount *account; + BOOL user, group, editable; + + user = NO; + group = NO; + enumerator = [_accounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + if([account isKindOfClass:[WCUserAccount class]] || (_creating && [_typePopUpButton selectedItem] == _userMenuItem)) + user = YES; + else if([account isKindOfClass:[WCGroupAccount class]] || (_creating && [_typePopUpButton selectedItem] == _groupMenuItem)) + group = YES; + } + + editable = YES; + account = [[_administration connection] account]; + + if(user) { + if(_creating && ![account accountCreateUsers]) + editable = NO; + else if(_editing && ![account accountEditUsers]) + editable = NO; + } + + if(group) { + if(_creating && ![account accountCreateGroups]) + editable = NO; + else if(_editing && ![account accountEditGroups]) + editable = NO; + } + + return editable; } #pragma mark - - (void)_readAccount:(WCAccount *)account { - WIP7Message *message; - - if([account isKindOfClass:[WCUserAccount class]]) - message = [WIP7Message messageWithName:@"wired.account.read_user" spec:WCP7Spec]; - else - message = [WIP7Message messageWithName:@"wired.account.read_group" spec:WCP7Spec]; + WIP7Message *message; + + if([account isKindOfClass:[WCUserAccount class]]) + message = [WIP7Message messageWithName:@"wired.account.read_user" spec:WCP7Spec]; + else + message = [WIP7Message messageWithName:@"wired.account.read_group" spec:WCP7Spec]; - [message setString:[account name] forName:@"wired.account.name"]; - [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountReadAccountReply:)]; - - [_progressIndicator startAnimation:self]; + [message setString:[account name] forName:@"wired.account.name"]; + [[_administration connection] sendMessage:message fromObserver:self selector:@selector(wiredAccountReadAccountReply:)]; + + [_progressIndicator startAnimation:self]; } - (void)_readAccounts:(NSArray *)accounts { - NSEnumerator *enumerator; - WCAccount *account; - - [_accounts removeAllObjects]; - - _requestedAccounts = [accounts count]; - - enumerator = [accounts objectEnumerator]; - - while((account = [enumerator nextObject])) - [self _readAccount:account]; + NSEnumerator *enumerator; + WCAccount *account; + + [_accounts removeAllObjects]; + + _requestedAccounts = [accounts count]; + + enumerator = [accounts objectEnumerator]; + + while((account = [enumerator nextObject])) + [self _readAccount:account]; } - (void)_readFromAccounts { - NSEnumerator *enumerator; - NSDictionary *section; - NSArray *groups; - NSString *group; - WCAccount *account; - - if([_accounts count] == 1) { - if([_groupPopUpButton indexOfItem:_dontChangeGroupMenuItem] != -1) - [_groupPopUpButton removeItem:_dontChangeGroupMenuItem]; - - account = [_accounts lastObject]; - - if(_editing) { - if([account isKindOfClass:[WCUserAccount class]]) { - [_typePopUpButton selectItem:_userMenuItem]; - - if([(WCUserAccount *) account fullName]) - [_fullNameTextField setStringValue:[(WCUserAccount *) account fullName]]; - else - [_fullNameTextField setStringValue:@""]; - - if([(WCUserAccount *) account password] && ![[(WCUserAccount *) account password] isEqualToString:[@"" SHA1]]) - [_passwordTextField setStringValue:[(WCUserAccount *) account password]]; - else - [_passwordTextField setStringValue:@""]; - - if([[(WCUserAccount *) account group] length] > 0) - [_groupPopUpButton selectItemWithTitle:[(WCUserAccount *) account group]]; - else - [_groupPopUpButton selectItem:_noneMenuItem]; - - if([(WCUserAccount *) account groups]) - [_groupsTokenField setStringValue:[[(WCUserAccount *) account groups] componentsJoinedByString:@","]]; - else - [_groupsTokenField setStringValue:@""]; - - if([(WCUserAccount *) account loginDate] && ![[(WCUserAccount *) account loginDate] isAtBeginningOfAnyEpoch]) - [_loginTimeTextField setStringValue:[_dateFormatter stringFromDate:[(WCUserAccount *) account loginDate]]]; - else - [_loginTimeTextField setStringValue:@""]; - - [_downloadsTextField setStringValue:[NSSWF:NSLS(@"%u completed, %@ transferred", @"Account transfer stats (count, transferred"), - [(WCUserAccount *) account downloads], - [_sizeFormatter stringFromSize:[(WCUserAccount *) account downloadTransferred]]]]; - - [_uploadsTextField setStringValue:[NSSWF:NSLS(@"%u completed, %@ transferred", @"Account transfer stats (count, transferred"), - [(WCUserAccount *) account uploads], - [_sizeFormatter stringFromSize:[(WCUserAccount *) account uploadTransferred]]]]; - } - else if([account isKindOfClass:[WCGroupAccount class]]) { - [_typePopUpButton selectItem:_groupMenuItem]; - [_fullNameTextField setStringValue:@""]; - [_passwordTextField setStringValue:@""]; - [_groupPopUpButton selectItem:_noneMenuItem]; - [_groupsTokenField setStringValue:@""]; - [_loginTimeTextField setStringValue:@""]; - [_downloadsTextField setStringValue:@""]; - [_uploadsTextField setStringValue:@""]; - } - - [_nameTextField setStringValue:[account name]]; - [_commentTextView setString:[account comment]]; - - if([account creationDate] && ![[account creationDate] isAtBeginningOfAnyEpoch]) - [_creationTimeTextField setStringValue:[_dateFormatter stringFromDate:[account creationDate]]]; - else - [_creationTimeTextField setStringValue:@""]; - - if([account modificationDate] && ![[account modificationDate] isAtBeginningOfAnyEpoch]) - [_modificationTimeTextField setStringValue:[_dateFormatter stringFromDate:[account modificationDate]]]; - else - [_modificationTimeTextField setStringValue:@""]; - - if([account editedBy]) - [_editedByTextField setStringValue:[account editedBy]]; - else - [_editedByTextField setStringValue:@""]; - } - } - else if([_accounts count] == 0) { - if([_groupPopUpButton indexOfItem:_dontChangeGroupMenuItem] != -1) - [_groupPopUpButton removeItem:_dontChangeGroupMenuItem]; - - [_typePopUpButton selectItem:_userMenuItem]; - [_nameTextField setStringValue:@""]; - [_fullNameTextField setStringValue:@""]; - [_passwordTextField setStringValue:@""]; - [_groupPopUpButton selectItem:_noneMenuItem]; - [_groupsTokenField setStringValue:@""]; - [_commentTextView setString:@""]; - [_creationTimeTextField setStringValue:@""]; - [_modificationTimeTextField setStringValue:@""]; - [_loginTimeTextField setStringValue:@""]; - [_editedByTextField setStringValue:@""]; - [_downloadsTextField setStringValue:@""]; - [_uploadsTextField setStringValue:@""]; - } - else { - if([_groupPopUpButton indexOfItem:_dontChangeGroupMenuItem] == -1) { - [_groupPopUpButton insertItem:_dontChangeGroupMenuItem atIndex:0]; - - [_dontChangeGroupMenuItem setState:NSOffState]; - } - - group = NULL; - enumerator = [_accounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - if(group) { - if(![account isKindOfClass:[WCUserAccount class]] || ![group isEqualToString:[(WCUserAccount *) account group]]) { - group = NULL; - - break; - } - } else { - if([account isKindOfClass:[WCUserAccount class]]) - group = [(WCUserAccount *) account group]; - } - } - - groups = NULL; - enumerator = [_accounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - if(groups) { - if(![account isKindOfClass:[WCUserAccount class]] || ![groups isEqualToArray:[(WCUserAccount *) account groups]]) { - groups = NULL; - - break; - } - } else { - if([account isKindOfClass:[WCUserAccount class]]) - groups = [(WCUserAccount *) account groups]; - } - } - - [_typePopUpButton selectItem:_userMenuItem]; - [_nameTextField setStringValue:@""]; - [_fullNameTextField setStringValue:@""]; - [_passwordTextField setStringValue:@""]; - - if(group == NULL) - [_groupPopUpButton selectItem:_dontChangeGroupMenuItem]; - else if([group length] == 0) - [_groupPopUpButton selectItem:_noneMenuItem]; - else - [_groupPopUpButton selectItemWithTitle:group]; - - if(groups == NULL) - [_groupsTokenField setStringValue:NSLS(@"", @"Account field value")]; - else - [_groupsTokenField setStringValue:[groups componentsJoinedByString:@","]]; - - [_commentTextView setString:@""]; - [_creationTimeTextField setStringValue:@""]; - [_modificationTimeTextField setStringValue:@""]; - [_loginTimeTextField setStringValue:@""]; - [_editedByTextField setStringValue:@""]; - [_downloadsTextField setStringValue:@""]; - [_uploadsTextField setStringValue:@""]; - } - - [self _reloadSettings]; - - [_settingsOutlineView reloadData]; - - enumerator = [_shownSettings objectEnumerator]; - - while((section = [enumerator nextObject])) - [_settingsOutlineView expandItem:section]; + NSEnumerator *enumerator; + NSDictionary *section; + NSArray *groups; + NSString *group; + WCAccount *account; + + if([_accounts count] == 1) { + if([_groupPopUpButton indexOfItem:_dontChangeGroupMenuItem] != -1) + [_groupPopUpButton removeItem:_dontChangeGroupMenuItem]; + + account = [_accounts lastObject]; + + if(_editing) { + if([account isKindOfClass:[WCUserAccount class]]) { + [_typePopUpButton selectItem:_userMenuItem]; + + if([(WCUserAccount *) account fullName]) + [_fullNameTextField setStringValue:[(WCUserAccount *) account fullName]]; + else + [_fullNameTextField setStringValue:@""]; + + if([(WCUserAccount *) account password] && ![[(WCUserAccount *) account password] isEqualToString:[@"" SHA1]]) + [_passwordTextField setStringValue:[(WCUserAccount *) account password]]; + else + [_passwordTextField setStringValue:@""]; + + if([[(WCUserAccount *) account group] length] > 0) + [_groupPopUpButton selectItemWithTitle:[(WCUserAccount *) account group]]; + else + [_groupPopUpButton selectItem:_noneMenuItem]; + + if([(WCUserAccount *) account groups]) + [_groupsTokenField setStringValue:[[(WCUserAccount *) account groups] componentsJoinedByString:@","]]; + else + [_groupsTokenField setStringValue:@""]; + + if([(WCUserAccount *) account loginDate] && ![[(WCUserAccount *) account loginDate] isAtBeginningOfAnyEpoch]) + [_loginTimeTextField setStringValue:[_dateFormatter stringFromDate:[(WCUserAccount *) account loginDate]]]; + else + [_loginTimeTextField setStringValue:@""]; + + [_downloadsTextField setStringValue:[NSSWF:NSLS(@"%u completed, %@ transferred", @"Account transfer stats (count, transferred"), + [(WCUserAccount *) account downloads], + [_sizeFormatter stringFromSize:[(WCUserAccount *) account downloadTransferred]]]]; + + [_uploadsTextField setStringValue:[NSSWF:NSLS(@"%u completed, %@ transferred", @"Account transfer stats (count, transferred"), + [(WCUserAccount *) account uploads], + [_sizeFormatter stringFromSize:[(WCUserAccount *) account uploadTransferred]]]]; + } + else if([account isKindOfClass:[WCGroupAccount class]]) { + [_typePopUpButton selectItem:_groupMenuItem]; + [_fullNameTextField setStringValue:@""]; + [_passwordTextField setStringValue:@""]; + [_groupPopUpButton selectItem:_noneMenuItem]; + [_groupsTokenField setStringValue:@""]; + [_loginTimeTextField setStringValue:@""]; + [_downloadsTextField setStringValue:@""]; + [_uploadsTextField setStringValue:@""]; + } + + [_nameTextField setStringValue:[account name]]; + [_commentTextView setString:[account comment]]; + + if([account creationDate] && ![[account creationDate] isAtBeginningOfAnyEpoch]) + [_creationTimeTextField setStringValue:[_dateFormatter stringFromDate:[account creationDate]]]; + else + [_creationTimeTextField setStringValue:@""]; + + if([account modificationDate] && ![[account modificationDate] isAtBeginningOfAnyEpoch]) + [_modificationTimeTextField setStringValue:[_dateFormatter stringFromDate:[account modificationDate]]]; + else + [_modificationTimeTextField setStringValue:@""]; + + if([account editedBy]) + [_editedByTextField setStringValue:[account editedBy]]; + else + [_editedByTextField setStringValue:@""]; + } + } + else if([_accounts count] == 0) { + if([_groupPopUpButton indexOfItem:_dontChangeGroupMenuItem] != -1) + [_groupPopUpButton removeItem:_dontChangeGroupMenuItem]; + + [_typePopUpButton selectItem:_userMenuItem]; + [_nameTextField setStringValue:@""]; + [_fullNameTextField setStringValue:@""]; + [_passwordTextField setStringValue:@""]; + [_groupPopUpButton selectItem:_noneMenuItem]; + [_groupsTokenField setStringValue:@""]; + [_commentTextView setString:@""]; + [_creationTimeTextField setStringValue:@""]; + [_modificationTimeTextField setStringValue:@""]; + [_loginTimeTextField setStringValue:@""]; + [_editedByTextField setStringValue:@""]; + [_downloadsTextField setStringValue:@""]; + [_uploadsTextField setStringValue:@""]; + } + else { + if([_groupPopUpButton indexOfItem:_dontChangeGroupMenuItem] == -1) { + [_groupPopUpButton insertItem:_dontChangeGroupMenuItem atIndex:0]; + + [_dontChangeGroupMenuItem setState:NSOffState]; + } + + group = NULL; + enumerator = [_accounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + if(group) { + if(![account isKindOfClass:[WCUserAccount class]] || ![group isEqualToString:[(WCUserAccount *) account group]]) { + group = NULL; + + break; + } + } else { + if([account isKindOfClass:[WCUserAccount class]]) + group = [(WCUserAccount *) account group]; + } + } + + groups = NULL; + enumerator = [_accounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + if(groups) { + if(![account isKindOfClass:[WCUserAccount class]] || ![groups isEqualToArray:[(WCUserAccount *) account groups]]) { + groups = NULL; + + break; + } + } else { + if([account isKindOfClass:[WCUserAccount class]]) + groups = [(WCUserAccount *) account groups]; + } + } + + [_typePopUpButton selectItem:_userMenuItem]; + [_nameTextField setStringValue:@""]; + [_fullNameTextField setStringValue:@""]; + [_passwordTextField setStringValue:@""]; + + if(group == NULL) + [_groupPopUpButton selectItem:_dontChangeGroupMenuItem]; + else if([group length] == 0) + [_groupPopUpButton selectItem:_noneMenuItem]; + else + [_groupPopUpButton selectItemWithTitle:group]; + + if(groups == NULL) + [_groupsTokenField setStringValue:NSLS(@"", @"Account field value")]; + else + [_groupsTokenField setStringValue:[groups componentsJoinedByString:@","]]; + + [_commentTextView setString:@""]; + [_creationTimeTextField setStringValue:@""]; + [_modificationTimeTextField setStringValue:@""]; + [_loginTimeTextField setStringValue:@""]; + [_editedByTextField setStringValue:@""]; + [_downloadsTextField setStringValue:@""]; + [_uploadsTextField setStringValue:@""]; + } + + [self _reloadSettings]; + + [_settingsOutlineView reloadData]; + + enumerator = [_shownSettings objectEnumerator]; + + while((section = [enumerator nextObject])) + [_settingsOutlineView expandItem:section]; } - (void)_validateForAccounts { - NSEnumerator *enumerator; - WCAccount *account; - BOOL editable, group; - - [_userMenuItem setEnabled:[[[_administration connection] account] accountCreateUsers]]; - [_groupMenuItem setEnabled:[[[_administration connection] account] accountCreateGroups]]; - - if([_accounts count] == 1) { - account = [_accounts lastObject]; - editable = [self _canEditAccounts]; - - [_typePopUpButton setEnabled:(_creating && editable)]; - [_nameTextField setEnabled:editable]; - - if([account isKindOfClass:[WCUserAccount class]] || (_creating && [_typePopUpButton selectedItem] == _userMenuItem)) { - [_fullNameTextField setEnabled:editable]; - [_passwordTextField setEnabled:editable]; - [_groupPopUpButton setEnabled:editable]; - [_groupsTokenField setEnabled:editable]; - } - else if([account isKindOfClass:[WCGroupAccount class]] || (_creating && [_typePopUpButton selectedItem] == _groupMenuItem)) { - [_fullNameTextField setEnabled:NO]; - [_passwordTextField setEnabled:NO]; - [_groupPopUpButton setEnabled:NO]; - [_groupsTokenField setEnabled:NO]; - } - - [_commentTextView setEditable:editable]; - [_selectAllButton setEnabled:YES]; + NSEnumerator *enumerator; + WCAccount *account; + BOOL editable, group; + + [_userMenuItem setEnabled:[[[_administration connection] account] accountCreateUsers]]; + [_groupMenuItem setEnabled:[[[_administration connection] account] accountCreateGroups]]; + + if([_accounts count] == 1) { + account = [_accounts lastObject]; + editable = [self _canEditAccounts]; + + [_typePopUpButton setEnabled:(_creating && editable)]; + [_nameTextField setEnabled:editable]; + + if([account isKindOfClass:[WCUserAccount class]] || (_creating && [_typePopUpButton selectedItem] == _userMenuItem)) { + [_fullNameTextField setEnabled:editable]; + [_passwordTextField setEnabled:editable]; + [_groupPopUpButton setEnabled:editable]; + [_groupsTokenField setEnabled:editable]; + } + else if([account isKindOfClass:[WCGroupAccount class]] || (_creating && [_typePopUpButton selectedItem] == _groupMenuItem)) { + [_fullNameTextField setEnabled:NO]; + [_passwordTextField setEnabled:NO]; + [_groupPopUpButton setEnabled:NO]; + [_groupsTokenField setEnabled:NO]; + } + + [_commentTextView setEditable:editable]; + [_selectAllButton setEnabled:YES]; [_clearAllButton setEnabled:YES]; - } - else if([_accounts count] == 0) { - [_typePopUpButton setEnabled:NO]; - [_nameTextField setEnabled:NO]; - [_fullNameTextField setEnabled:NO]; - [_passwordTextField setEnabled:NO]; - [_groupPopUpButton setEnabled:NO]; - [_groupsTokenField setEnabled:NO]; - [_commentTextView setEditable:NO]; - [_selectAllButton setEnabled:NO]; + } + else if([_accounts count] == 0) { + [_typePopUpButton setEnabled:NO]; + [_nameTextField setEnabled:NO]; + [_fullNameTextField setEnabled:NO]; + [_passwordTextField setEnabled:NO]; + [_groupPopUpButton setEnabled:NO]; + [_groupsTokenField setEnabled:NO]; + [_commentTextView setEditable:NO]; + [_selectAllButton setEnabled:NO]; [_clearAllButton setEnabled:NO]; - } - else { - group = NO; - enumerator = [_accounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - if([account isKindOfClass:[WCGroupAccount class]]) - group = YES; - } - - [_typePopUpButton setEnabled:NO]; - [_nameTextField setEnabled:NO]; - [_fullNameTextField setEnabled:NO]; - [_passwordTextField setEnabled:NO]; - [_groupPopUpButton setEnabled:!group]; - [_groupsTokenField setEnabled:!group]; - [_commentTextView setEditable:NO]; - [_selectAllButton setEnabled:YES]; + } + else { + group = NO; + enumerator = [_accounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + if([account isKindOfClass:[WCGroupAccount class]]) + group = YES; + } + + [_typePopUpButton setEnabled:NO]; + [_nameTextField setEnabled:NO]; + [_fullNameTextField setEnabled:NO]; + [_passwordTextField setEnabled:NO]; + [_groupPopUpButton setEnabled:!group]; + [_groupsTokenField setEnabled:!group]; + [_commentTextView setEditable:NO]; + [_selectAllButton setEnabled:YES]; [_clearAllButton setEnabled:YES]; - } - - [_settingsOutlineView setNeedsDisplay:YES]; + } + + [_settingsOutlineView setNeedsDisplay:YES]; } - (void)_writeToAccounts:(NSArray *)accounts { - NSEnumerator *enumerator; - NSString *password, *group; - NSArray *groups; - WCAccount *account; - - if([accounts count] == 1) { - account = [accounts lastObject]; - - if(_editing) - [account setNewName:[_nameTextField stringValue]]; - else - [account setName:[_nameTextField stringValue]]; - - [account setComment:[_commentTextView string]]; - - if([account isKindOfClass:[WCUserAccount class]]) { - [(WCUserAccount *) account setFullName:[_fullNameTextField stringValue]]; - - if([[_passwordTextField stringValue] isEqualToString:@""]) - password = [@"" SHA1]; - else if(![[(WCUserAccount *) account password] isEqualToString:[_passwordTextField stringValue]]) - password = [[_passwordTextField stringValue] SHA1]; - else - password = [(WCUserAccount *) account password]; - - [(WCUserAccount *) account setPassword:password]; - - if([_groupPopUpButton selectedItem] != _noneMenuItem) - group = [_groupPopUpButton titleOfSelectedItem]; - else - group = @""; - - [(WCUserAccount *) account setGroup:group]; - - groups = [[_groupsTokenField stringValue] componentsSeparatedByCharactersFromSet: - [_groupsTokenField tokenizingCharacterSet]]; - - if(!groups) - groups = [NSArray array]; - - [(WCUserAccount *) account setGroups:groups]; - } - } else { - enumerator = [accounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - if([account isKindOfClass:[WCUserAccount class]]) { - if([_groupPopUpButton selectedItem] != _dontChangeGroupMenuItem) { - if([_groupPopUpButton selectedItem] != _noneMenuItem) - group = [_groupPopUpButton titleOfSelectedItem]; - else - group = @""; - - [(WCUserAccount *) account setGroup:group]; - } - - if(![[_groupsTokenField stringValue] isEqualToString:NSLS(@"", @"Account field value")]) { - groups = [[_groupsTokenField stringValue] componentsSeparatedByCharactersFromSet: - [_groupsTokenField tokenizingCharacterSet]]; - - if(!groups) - groups = [NSArray array]; - - [(WCUserAccount *) account setGroups:groups]; - } - } - } - } + NSEnumerator *enumerator; + NSString *password, *group; + NSArray *groups; + WCAccount *account; + + if([accounts count] == 1) { + account = [accounts lastObject]; + + if(_editing) + [account setNewName:[_nameTextField stringValue]]; + else + [account setName:[_nameTextField stringValue]]; + + [account setComment:[_commentTextView string]]; + + if([account isKindOfClass:[WCUserAccount class]]) { + [(WCUserAccount *) account setFullName:[_fullNameTextField stringValue]]; + + if([[_passwordTextField stringValue] isEqualToString:@""]) + password = [@"" SHA1]; + else if(![[(WCUserAccount *) account password] isEqualToString:[_passwordTextField stringValue]]) + password = [[_passwordTextField stringValue] SHA1]; + else + password = [(WCUserAccount *) account password]; + + [(WCUserAccount *) account setPassword:password]; + + if([_groupPopUpButton selectedItem] != _noneMenuItem) + group = [_groupPopUpButton titleOfSelectedItem]; + else + group = @""; + + [(WCUserAccount *) account setGroup:group]; + + groups = [[_groupsTokenField stringValue] componentsSeparatedByCharactersFromSet: + [_groupsTokenField tokenizingCharacterSet]]; + + if(!groups) + groups = [NSArray array]; + + [(WCUserAccount *) account setGroups:groups]; + } + } else { + enumerator = [accounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + if([account isKindOfClass:[WCUserAccount class]]) { + if([_groupPopUpButton selectedItem] != _dontChangeGroupMenuItem) { + if([_groupPopUpButton selectedItem] != _noneMenuItem) + group = [_groupPopUpButton titleOfSelectedItem]; + else + group = @""; + + [(WCUserAccount *) account setGroup:group]; + } + + if(![[_groupsTokenField stringValue] isEqualToString:NSLS(@"", @"Account field value")]) { + groups = [[_groupsTokenField stringValue] componentsSeparatedByCharactersFromSet: + [_groupsTokenField tokenizingCharacterSet]]; + + if(!groups) + groups = [NSArray array]; + + [(WCUserAccount *) account setGroups:groups]; + } + } + } + } } #pragma mark - - (WCAccount *)_accountAtIndex:(NSUInteger)index { - NSUInteger i; - - i = ([_accountsTableView sortOrder] == WISortDescending) - ? [_shownAccounts count] - index - 1 - : index; - - return [_shownAccounts objectAtIndex:i]; + NSUInteger i; + + i = ([_accountsTableView sortOrder] == WISortDescending) + ? [_shownAccounts count] - index - 1 + : index; + + return [_shownAccounts objectAtIndex:i]; } - (NSArray *)_selectedAccounts { - NSMutableArray *array; - NSIndexSet *indexes; - NSUInteger index; - - array = [NSMutableArray array]; - indexes = [_accountsTableView selectedRowIndexes]; - index = [indexes firstIndex]; - - while(index != NSNotFound) { - [array addObject:[self _accountAtIndex:index]]; - - index = [indexes indexGreaterThanIndex:index]; - } - - return array; + NSMutableArray *array; + NSIndexSet *indexes; + NSUInteger index; + + array = [NSMutableArray array]; + indexes = [_accountsTableView selectedRowIndexes]; + index = [indexes firstIndex]; + + while(index != NSNotFound) { + [array addObject:[self _accountAtIndex:index]]; + + index = [indexes indexGreaterThanIndex:index]; + } + + return array; } - (void)_reloadGroups { - NSEnumerator *enumerator; - NSMutableArray *groupAccounts; - WCAccount *account; - NSUInteger count; - - count = ([_groupPopUpButton indexOfItem:_dontChangeGroupMenuItem] == -1) ? 1 : 2; - - while([_groupPopUpButton numberOfItems] > (NSInteger) count) - [_groupPopUpButton removeItemAtIndex:count]; - - while([_groupFilterPopUpButton numberOfItems] > 2) - [_groupFilterPopUpButton removeItemAtIndex:2]; - - groupAccounts = [NSMutableArray array]; - enumerator = [_allAccounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - if([account isKindOfClass:[WCGroupAccount class]]) - [groupAccounts addObject:account]; - } - - if([groupAccounts count] > 0) { - [[_groupFilterPopUpButton menu] addItem:[NSMenuItem separatorItem]]; - [[_groupPopUpButton menu] addItem:[NSMenuItem separatorItem]]; - - enumerator = [groupAccounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - if([account isKindOfClass:[WCGroupAccount class]]) { - [_groupFilterPopUpButton addItemWithTitle:[account name]]; - [_groupPopUpButton addItemWithTitle:[account name]]; - } - } - } + NSEnumerator *enumerator; + NSMutableArray *groupAccounts; + WCAccount *account; + NSUInteger count; + + count = ([_groupPopUpButton indexOfItem:_dontChangeGroupMenuItem] == -1) ? 1 : 2; + + while([_groupPopUpButton numberOfItems] > (NSInteger) count) + [_groupPopUpButton removeItemAtIndex:count]; + + while([_groupFilterPopUpButton numberOfItems] > 2) + [_groupFilterPopUpButton removeItemAtIndex:2]; + + groupAccounts = [NSMutableArray array]; + enumerator = [_allAccounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + if([account isKindOfClass:[WCGroupAccount class]]) + [groupAccounts addObject:account]; + } + + if([groupAccounts count] > 0) { + [[_groupFilterPopUpButton menu] addItem:[NSMenuItem separatorItem]]; + [[_groupPopUpButton menu] addItem:[NSMenuItem separatorItem]]; + + enumerator = [groupAccounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + if([account isKindOfClass:[WCGroupAccount class]]) { + [_groupFilterPopUpButton addItemWithTitle:[account name]]; + [_groupPopUpButton addItemWithTitle:[account name]]; + } + } + } } - (void)_reloadSettings { - NSEnumerator *enumerator, *settingsEnumerator, *accountsEnumerator; - NSMutableDictionary *newSection; - NSMutableArray *settings; - NSDictionary *section, *setting; - WCAccount *account; - - if([_showPopUpButton selectedItem] == _allSettingsMenuItem) { - [_shownSettings setArray:_allSettings]; - } else { - [_shownSettings removeAllObjects]; - - enumerator = [_allSettings objectEnumerator]; - - while((section = [enumerator nextObject])) { - settings = [NSMutableArray array]; - settingsEnumerator = [[section objectForKey:WCAccountsFieldSettings] objectEnumerator]; - - while((setting = [settingsEnumerator nextObject])) { - accountsEnumerator = [_accounts objectEnumerator]; - - while((account = [accountsEnumerator nextObject])) { - if([account valueForKey:[setting objectForKey:WCAccountFieldNameKey]]) { - [settings addObject:setting]; - - break; - } - } - } - - if([settings count] > 0) { - newSection = [[section mutableCopy] autorelease]; - [newSection setObject:settings forKey:WCAccountsFieldSettings]; - [_shownSettings addObject:newSection]; - } - } - } - - [_settingsOutlineView reloadData]; - - enumerator = [_shownSettings objectEnumerator]; - - while((section = [enumerator nextObject])) - [_settingsOutlineView expandItem:section]; + NSEnumerator *enumerator, *settingsEnumerator, *accountsEnumerator; + NSMutableDictionary *newSection; + NSMutableArray *settings; + NSDictionary *section, *setting; + WCAccount *account; + + if([_showPopUpButton selectedItem] == _allSettingsMenuItem) { + [_shownSettings setArray:_allSettings]; + } else { + [_shownSettings removeAllObjects]; + + enumerator = [_allSettings objectEnumerator]; + + while((section = [enumerator nextObject])) { + settings = [NSMutableArray array]; + settingsEnumerator = [[section objectForKey:WCAccountsFieldSettings] objectEnumerator]; + + while((setting = [settingsEnumerator nextObject])) { + accountsEnumerator = [_accounts objectEnumerator]; + + while((account = [accountsEnumerator nextObject])) { + if([account valueForKey:[setting objectForKey:WCAccountFieldNameKey]]) { + [settings addObject:setting]; + + break; + } + } + } + + if([settings count] > 0) { + newSection = [[section mutableCopy] autorelease]; + [newSection setObject:settings forKey:WCAccountsFieldSettings]; + [_shownSettings addObject:newSection]; + } + } + } + + [_settingsOutlineView reloadData]; + + enumerator = [_shownSettings objectEnumerator]; + + while((section = [enumerator nextObject])) + [_settingsOutlineView expandItem:section]; } - (BOOL)_filterIncludesAccount:(WCAccount *)account { - NSMenuItem *item; - BOOL passed; - - if([_allFilterButton state] != NSOnState) { - passed = NO; - - if([_usersFilterButton state] == NSOnState && [account isKindOfClass:[WCUserAccount class]]) - passed = YES; - else if([_groupsFilterButton state] == NSOnState && [account isKindOfClass:[WCGroupAccount class]]) - passed = YES; - - if(!passed) - return NO; - } - - item = [_groupFilterPopUpButton selectedItem]; - - if(item != _anyGroupMenuItem) { - passed = NO; - - if([account isKindOfClass:[WCUserAccount class]]) { - if(item == _noGroupMenuItem) - passed = [[(WCUserAccount *) account group] isEqualToString:@""]; - else - passed = [[(WCUserAccount *) account group] isEqualToString:[item title]]; - } - - if(!passed) - return NO; - } - - if(_accountFilter) { - passed = NO; - - if([[account name] containsSubstring:_accountFilter]) - passed = YES; - - if([account isKindOfClass:[WCUserAccount class]]) { - if([[(WCUserAccount *) account fullName] containsSubstring:_accountFilter]) - passed = YES; - } - - if(!passed) - return NO; - } - - return YES; + NSMenuItem *item; + BOOL passed; + + if([_allFilterButton state] != NSOnState) { + passed = NO; + + if([_usersFilterButton state] == NSOnState && [account isKindOfClass:[WCUserAccount class]]) + passed = YES; + else if([_groupsFilterButton state] == NSOnState && [account isKindOfClass:[WCGroupAccount class]]) + passed = YES; + + if(!passed) + return NO; + } + + item = [_groupFilterPopUpButton selectedItem]; + + if(item != _anyGroupMenuItem) { + passed = NO; + + if([account isKindOfClass:[WCUserAccount class]]) { + if(item == _noGroupMenuItem) + passed = [[(WCUserAccount *) account group] isEqualToString:@""]; + else + passed = [[(WCUserAccount *) account group] isEqualToString:[item title]]; + } + + if(!passed) + return NO; + } + + if(_accountFilter) { + passed = NO; + + if([[account name] containsSubstring:_accountFilter]) + passed = YES; + + if([account isKindOfClass:[WCUserAccount class]]) { + if([[(WCUserAccount *) account fullName] containsSubstring:_accountFilter]) + passed = YES; + } + + if(!passed) + return NO; + } + + return YES; } - (void)_reloadFilter { - NSEnumerator *enumerator; - WCAccount *account; - - [_shownAccounts removeAllObjects]; - - enumerator = [_allAccounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - if([self _filterIncludesAccount:account]) - [_shownAccounts addObject:account]; - } - - [_statusTextField setStringValue:[NSSWF:NSLS(@"%u %@", @"Accounts (count, 'account(s)'"), - [_shownAccounts count], - [_shownAccounts count] == 1 - ? NSLS(@"account", @"Account singular") - : NSLS(@"accounts", @"Account plural")]]; + NSEnumerator *enumerator; + WCAccount *account; + + [_shownAccounts removeAllObjects]; + + enumerator = [_allAccounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + if([self _filterIncludesAccount:account]) + [_shownAccounts addObject:account]; + } + + [_statusTextField setStringValue:[NSSWF:NSLS(@"%u %@", @"Accounts (count, 'account(s)'"), + [_shownAccounts count], + [_shownAccounts count] == 1 + ? NSLS(@"account", @"Account singular") + : NSLS(@"accounts", @"Account plural")]]; } - (void)_selectAccounts { - NSEnumerator *enumerator; - NSMutableIndexSet *indexes; - WCAccount *account; - NSUInteger index; - - if([_selectAccounts count] > 0) { - indexes = [NSMutableIndexSet indexSet]; - enumerator = [_selectAccounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - index = [_shownAccounts indexOfObject:account]; - - if(index != NSNotFound) - [indexes addIndex:index]; - } - - [_accountsTableView selectRowIndexes:indexes byExtendingSelection:NO]; - [_selectAccounts removeAllObjects]; - } else { - if([[_accountsTableView selectedRowIndexes] count] == 0) { - indexes = [NSMutableIndexSet indexSet]; - enumerator = [_accounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - index = [_shownAccounts indexOfObject:account]; - - if(index != NSNotFound) - [indexes addIndex:index]; - } - - [_accountsTableView selectRowIndexes:indexes byExtendingSelection:NO]; - } - } + NSEnumerator *enumerator; + NSMutableIndexSet *indexes; + WCAccount *account; + NSUInteger index; + + if([_selectAccounts count] > 0) { + indexes = [NSMutableIndexSet indexSet]; + enumerator = [_selectAccounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + index = [_shownAccounts indexOfObject:account]; + + if(index != NSNotFound) + [indexes addIndex:index]; + } + + [_accountsTableView selectRowIndexes:indexes byExtendingSelection:NO]; + [_selectAccounts removeAllObjects]; + } else { + if([[_accountsTableView selectedRowIndexes] count] == 0) { + indexes = [NSMutableIndexSet indexSet]; + enumerator = [_accounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + index = [_shownAccounts indexOfObject:account]; + + if(index != NSNotFound) + [indexes addIndex:index]; + } + + [_accountsTableView selectRowIndexes:indexes byExtendingSelection:NO]; + } + } } @end @@ -964,1048 +995,1048 @@ - (void)_selectAccounts { @implementation WCAccountsController - (id)init { - NSEnumerator *enumerator; - NSMutableDictionary *setting; - NSDictionary *field; - NSMutableArray *basicsSettings, *filesSettings, *boardsSettings, *trackerSettings, *usersSettings, *accountsSettings, *administrationSettings, *limitsSettings; - NSButtonCell *buttonCell; - NSTextFieldCell *textFieldCell; - NSPopUpButtonCell *popUpButtonCell; - - self = [super init]; - - _listedAccounts = [[NSMutableDictionary alloc] init]; - _allAccounts = [[NSMutableArray alloc] init]; - _allUserAccounts = [[NSMutableArray alloc] init]; - _allGroupAccounts = [[NSMutableArray alloc] init]; - _shownAccounts = [[NSMutableArray alloc] init]; - _userImage = [[NSImage imageNamed:@"User"] retain]; - _groupImage = [[NSImage imageNamed:@"Group"] retain]; - _accounts = [[NSMutableArray alloc] init]; - _selectAccounts = [[NSMutableArray alloc] init]; - _deletedAccounts = [[NSMutableDictionary alloc] init]; - - basicsSettings = [NSMutableArray array]; - filesSettings = [NSMutableArray array]; - boardsSettings = [NSMutableArray array]; - trackerSettings = [NSMutableArray array]; - usersSettings = [NSMutableArray array]; - accountsSettings = [NSMutableArray array]; - administrationSettings = [NSMutableArray array]; - limitsSettings = [NSMutableArray array]; - enumerator = [[WCAccount fields] objectEnumerator]; - - while((field = [enumerator nextObject])) { - setting = [[field mutableCopy] autorelease]; - - switch((WCAccountFieldType) [[setting objectForKey:WCAccountFieldTypeKey] integerValue]) { - case WCAccountFieldTypeBoolean: - buttonCell = [[NSButtonCell alloc] initTextCell:@""]; - [buttonCell setControlSize:NSSmallControlSize]; - [buttonCell setButtonType:NSSwitchButton]; - [buttonCell setAllowsMixedState:YES]; - [setting setObject:buttonCell forKey:WCAccountsFieldCell]; - [buttonCell release]; - break; - - case WCAccountFieldTypeNumber: - case WCAccountFieldTypeString: - textFieldCell = [[NSTextFieldCell alloc] initTextCell:@""]; - [textFieldCell setControlSize:NSSmallControlSize]; - [textFieldCell setEditable:YES]; - [textFieldCell setSelectable:YES]; - [textFieldCell setFont:[NSFont smallSystemFont]]; - [setting setObject:textFieldCell forKey:WCAccountsFieldCell]; - [textFieldCell release]; - break; - - case WCAccountFieldTypeEnum: - popUpButtonCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]; - [popUpButtonCell setControlSize:NSSmallControlSize]; - [popUpButtonCell setBordered:NO]; - [popUpButtonCell setFont:[NSFont smallSystemFont]]; - - if([[setting objectForKey:WCAccountFieldNameKey] isEqualToString:@"wired.account.color"]) { - [popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Black", @"Account color") - image:[NSImage imageNamed:@"LabelBlack"]]]; - [popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Red", @"Account color") - image:[NSImage imageNamed:@"LabelRed"]]]; - [popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Orange", @"Account color") - image:[NSImage imageNamed:@"LabelOrange"]]]; - [popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Green", @"Account color") - image:[NSImage imageNamed:@"LabelGreen"]]]; - [popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Blue", @"Account color") - image:[NSImage imageNamed:@"LabelBlue"]]]; - [popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Purple", @"Account color") - image:[NSImage imageNamed:@"LabelPurple"]]]; + NSEnumerator *enumerator; + NSMutableDictionary *setting; + NSDictionary *field; + NSMutableArray *basicsSettings, *filesSettings, *boardsSettings, *trackerSettings, *usersSettings, *accountsSettings, *administrationSettings, *limitsSettings; + NSButtonCell *buttonCell; + NSTextFieldCell *textFieldCell; + + self = [super init]; + + _listedAccounts = [[NSMutableDictionary alloc] init]; + _allAccounts = [[NSMutableArray alloc] init]; + _allUserAccounts = [[NSMutableArray alloc] init]; + _allGroupAccounts = [[NSMutableArray alloc] init]; + _shownAccounts = [[NSMutableArray alloc] init]; + _userImage = [[NSImage imageNamed:@"User"] retain]; + _groupImage = [[NSImage imageNamed:@"Group"] retain]; + _accounts = [[NSMutableArray alloc] init]; + _selectAccounts = [[NSMutableArray alloc] init]; + _deletedAccounts = [[NSMutableDictionary alloc] init]; + + basicsSettings = [NSMutableArray array]; + filesSettings = [NSMutableArray array]; + boardsSettings = [NSMutableArray array]; + trackerSettings = [NSMutableArray array]; + usersSettings = [NSMutableArray array]; + accountsSettings = [NSMutableArray array]; + administrationSettings = [NSMutableArray array]; + limitsSettings = [NSMutableArray array]; + enumerator = [[WCAccount fields] objectEnumerator]; + + while((field = [enumerator nextObject])) { + setting = [[field mutableCopy] autorelease]; + + switch((WCAccountFieldType) [[setting objectForKey:WCAccountFieldTypeKey] integerValue]) { + case WCAccountFieldTypeBoolean: + buttonCell = [[NSButtonCell alloc] initTextCell:@""]; + [buttonCell setControlSize:NSSmallControlSize]; + [buttonCell setButtonType:NSSwitchButton]; + [buttonCell setAllowsMixedState:YES]; + [setting setObject:buttonCell forKey:WCAccountsFieldCell]; + [buttonCell release]; + break; + + case WCAccountFieldTypeNumber: + case WCAccountFieldTypeString: + textFieldCell = [[NSTextFieldCell alloc] initTextCell:@""]; + [textFieldCell setControlSize:NSSmallControlSize]; + [textFieldCell setEditable:YES]; + [textFieldCell setSelectable:YES]; + [textFieldCell setFont:[NSFont smallSystemFont]]; + [setting setObject:textFieldCell forKey:WCAccountsFieldCell]; + [textFieldCell release]; + break; + + case WCAccountFieldTypeEnum: + _popUpButtonCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]; + [_popUpButtonCell setControlSize:NSSmallControlSize]; + [_popUpButtonCell setBordered:NO]; + [_popUpButtonCell setFont:[NSFont smallSystemFont]]; + + if([[setting objectForKey:WCAccountFieldNameKey] isEqualToString:@"wired.account.color"]) { + [self _reloadColorsPopUpButtonMenu]; //[popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Gray", @"Account color") //image:[NSImage imageNamed:@"LabelGray"]]]; //[popUpButtonCell addItem:[NSMenuItem itemWithTitle:NSLS(@"Yellow", @"Account color") //image:[NSImage imageNamed:@"LabelYellow"]]]; - } - - [setting setObject:popUpButtonCell forKey:WCAccountsFieldCell]; - [popUpButtonCell release]; - break; - - case WCAccountFieldTypeDate: - case WCAccountFieldTypeList: - break; - } - - switch((WCAccountFieldSection) [[setting objectForKey:WCAccountFieldSectionKey] integerValue]) { - case WCAccountFieldSectionNone: - break; - - case WCAccountFieldSectionBasics: - [basicsSettings addObject:setting]; - break; - - case WCAccountFieldSectionFiles: - [filesSettings addObject:setting]; - break; - - case WCAccountFieldSectionBoards: - [boardsSettings addObject:setting]; - break; - - case WCAccountFieldSectionTracker: - [trackerSettings addObject:setting]; - break; - - case WCAccountFieldSectionUsers: - [usersSettings addObject:setting]; - break; - - case WCAccountFieldSectionAccounts: - [accountsSettings addObject:setting]; - break; - - case WCAccountFieldSectionAdministration: - [administrationSettings addObject:setting]; - break; - - case WCAccountFieldSectionLimits: - [limitsSettings addObject:setting]; - break; - } - } - - _allSettings = [[NSArray alloc] initWithObjects: - [NSDictionary dictionaryWithObjectsAndKeys: - NSLS(@"Basics", @"Account section"), WCAccountFieldLocalizedNameKey, - basicsSettings, WCAccountsFieldSettings, - NULL], - [NSDictionary dictionaryWithObjectsAndKeys: - NSLS(@"Files", @"Account section"), WCAccountFieldLocalizedNameKey, - filesSettings, WCAccountsFieldSettings, - NULL], - [NSDictionary dictionaryWithObjectsAndKeys: - NSLS(@"Boards", @"Account section"), WCAccountFieldLocalizedNameKey, - boardsSettings, WCAccountsFieldSettings, - NULL], - [NSDictionary dictionaryWithObjectsAndKeys: - NSLS(@"Tracker", @"Account section"), WCAccountFieldLocalizedNameKey, - trackerSettings, WCAccountsFieldSettings, - NULL], - [NSDictionary dictionaryWithObjectsAndKeys: - NSLS(@"Users", @"Account section"), WCAccountFieldLocalizedNameKey, - usersSettings, WCAccountsFieldSettings, - NULL], - [NSDictionary dictionaryWithObjectsAndKeys: - NSLS(@"Accounts", @"Account section"), WCAccountFieldLocalizedNameKey, - accountsSettings, WCAccountsFieldSettings, - NULL], - [NSDictionary dictionaryWithObjectsAndKeys: - NSLS(@"Administration", @"Account section"), WCAccountFieldLocalizedNameKey, - administrationSettings, WCAccountsFieldSettings, - NULL], - [NSDictionary dictionaryWithObjectsAndKeys: - NSLS(@"Limits", @"Account section"), WCAccountFieldLocalizedNameKey, - limitsSettings, WCAccountsFieldSettings, - NULL], - NULL]; - - _shownSettings = [_allSettings mutableCopy]; - - return self; + } + + [setting setObject:_popUpButtonCell forKey:WCAccountsFieldCell]; + [_popUpButtonCell autorelease]; + + break; + + case WCAccountFieldTypeDate: + case WCAccountFieldTypeList: + break; + } + + switch((WCAccountFieldSection) [[setting objectForKey:WCAccountFieldSectionKey] integerValue]) { + case WCAccountFieldSectionNone: + break; + + case WCAccountFieldSectionBasics: + [basicsSettings addObject:setting]; + break; + + case WCAccountFieldSectionFiles: + [filesSettings addObject:setting]; + break; + + case WCAccountFieldSectionBoards: + [boardsSettings addObject:setting]; + break; + + case WCAccountFieldSectionTracker: + [trackerSettings addObject:setting]; + break; + + case WCAccountFieldSectionUsers: + [usersSettings addObject:setting]; + break; + + case WCAccountFieldSectionAccounts: + [accountsSettings addObject:setting]; + break; + + case WCAccountFieldSectionAdministration: + [administrationSettings addObject:setting]; + break; + + case WCAccountFieldSectionLimits: + [limitsSettings addObject:setting]; + break; + } + } + + _allSettings = [[NSArray alloc] initWithObjects: + [NSDictionary dictionaryWithObjectsAndKeys: + NSLS(@"Basics", @"Account section"), WCAccountFieldLocalizedNameKey, + basicsSettings, WCAccountsFieldSettings, + NULL], + [NSDictionary dictionaryWithObjectsAndKeys: + NSLS(@"Files", @"Account section"), WCAccountFieldLocalizedNameKey, + filesSettings, WCAccountsFieldSettings, + NULL], + [NSDictionary dictionaryWithObjectsAndKeys: + NSLS(@"Boards", @"Account section"), WCAccountFieldLocalizedNameKey, + boardsSettings, WCAccountsFieldSettings, + NULL], + [NSDictionary dictionaryWithObjectsAndKeys: + NSLS(@"Tracker", @"Account section"), WCAccountFieldLocalizedNameKey, + trackerSettings, WCAccountsFieldSettings, + NULL], + [NSDictionary dictionaryWithObjectsAndKeys: + NSLS(@"Users", @"Account section"), WCAccountFieldLocalizedNameKey, + usersSettings, WCAccountsFieldSettings, + NULL], + [NSDictionary dictionaryWithObjectsAndKeys: + NSLS(@"Accounts", @"Account section"), WCAccountFieldLocalizedNameKey, + accountsSettings, WCAccountsFieldSettings, + NULL], + [NSDictionary dictionaryWithObjectsAndKeys: + NSLS(@"Administration", @"Account section"), WCAccountFieldLocalizedNameKey, + administrationSettings, WCAccountsFieldSettings, + NULL], + [NSDictionary dictionaryWithObjectsAndKeys: + NSLS(@"Limits", @"Account section"), WCAccountFieldLocalizedNameKey, + limitsSettings, WCAccountsFieldSettings, + NULL], + NULL]; + + _shownSettings = [_allSettings mutableCopy]; + + [[NSDistributedNotificationCenter defaultCenter] addObserver:self + selector:@selector(appleInterfaceThemeChanged:) + name:@"AppleInterfaceThemeChangedNotification" + object: nil]; + + return self; } - (void)dealloc { - [_dontChangeGroupMenuItem release]; - - [_allSettings release]; - [_shownSettings release]; - - [_userImage release]; - [_groupImage release]; - - [_listedAccounts release]; - [_allAccounts release]; - [_allUserAccounts release]; - [_allGroupAccounts release]; - [_shownAccounts release]; - - [_accounts release]; - [_selectAccounts release]; - - [_dateFormatter release]; - [_sizeFormatter release]; - [_accountFilter release]; - - [_deletedAccounts release]; - - [super dealloc]; + [_dontChangeGroupMenuItem release]; + + [_allSettings release]; + [_shownSettings release]; + + [_userImage release]; + [_groupImage release]; + + [_listedAccounts release]; + [_allAccounts release]; + [_allUserAccounts release]; + [_allGroupAccounts release]; + [_shownAccounts release]; + + [_accounts release]; + [_selectAccounts release]; + + [_dateFormatter release]; + [_sizeFormatter release]; + [_accountFilter release]; + + [_deletedAccounts release]; + + [super dealloc]; } #pragma mark - - (void)windowDidLoad { - [[_administration connection] addObserver:self - selector:@selector(wiredAccountAccountsChanged:) - messageName:@"wired.account.accounts_changed"]; - - [_accountsTableView setTarget:self]; - [_accountsTableView setDeleteAction:@selector(delete:)]; - - [_settingsOutlineView setTarget:self]; - [_settingsOutlineView setDeleteAction:@selector(clearSetting:)]; - - [_dontChangeGroupMenuItem retain]; - - _dateFormatter = [[WIDateFormatter alloc] init]; - [_dateFormatter setTimeStyle:NSDateFormatterShortStyle]; - [_dateFormatter setDateStyle:NSDateFormatterMediumStyle]; - [_dateFormatter setNaturalLanguageStyle:WIDateFormatterCapitalizedNaturalLanguageStyle]; - - _sizeFormatter = [[WISizeFormatter alloc] init]; - - [self _validateForAccounts]; - [self _readFromAccounts]; + [[_administration connection] addObserver:self + selector:@selector(wiredAccountAccountsChanged:) + messageName:@"wired.account.accounts_changed"]; + + [_accountsTableView setTarget:self]; + [_accountsTableView setDeleteAction:@selector(delete:)]; + + [_settingsOutlineView setTarget:self]; + [_settingsOutlineView setDeleteAction:@selector(clearSetting:)]; + + [_dontChangeGroupMenuItem retain]; + + _dateFormatter = [[WIDateFormatter alloc] init]; + [_dateFormatter setTimeStyle:NSDateFormatterShortStyle]; + [_dateFormatter setDateStyle:NSDateFormatterMediumStyle]; + [_dateFormatter setNaturalLanguageStyle:WIDateFormatterCapitalizedNaturalLanguageStyle]; + + _sizeFormatter = [[WISizeFormatter alloc] init]; + + [self _validateForAccounts]; + [self _readFromAccounts]; } - (void)linkConnectionLoggedIn:(NSNotification *)notification { - [_allAccounts removeAllObjects]; - [_allUserAccounts removeAllObjects]; - [_allGroupAccounts removeAllObjects]; - [_shownAccounts removeAllObjects]; - - [_accountsTableView reloadData]; - - _requested = NO; + [_allAccounts removeAllObjects]; + [_allUserAccounts removeAllObjects]; + [_allGroupAccounts removeAllObjects]; + [_shownAccounts removeAllObjects]; + + [_accountsTableView reloadData]; + + _requested = NO; - if([[_administration window] isVisible] && [_administration selectedController] == self) - [self _requestAccounts]; - - [self _validate]; + if([[_administration window] isVisible] && [_administration selectedController] == self) + [self _requestAccounts]; + + [self _validate]; } - (void)serverConnectionPrivilegesDidChange:(NSNotification *)notification { - if([[[_administration connection] account] accountListAccounts]) { - if([[_administration window] isVisible] && [_administration selectedController] == self) - [self _requestAccounts]; - } else { - _requested = NO; - } - - [self _validate]; - [self _validateForAccounts]; + if([[[_administration connection] account] accountListAccounts]) { + if([[_administration window] isVisible] && [_administration selectedController] == self) + [self _requestAccounts]; + } else { + _requested = NO; + } + + [self _validate]; + [self _validateForAccounts]; } - (void)wiredAccountAccountsChanged:(WIP7Message *)message { - if([_selectAccounts count] == 0) - [_selectAccounts setArray:[self _selectedAccounts]]; - - [self _reloadAccounts]; + if([_selectAccounts count] == 0) + [_selectAccounts setArray:[self _selectedAccounts]]; + + [self _reloadAccounts]; } - (void)wiredAccountListAccountsReply:(WIP7Message *)message { - NSMutableArray *accounts; - NSNumber *number; - WIP7UInt32 transaction; - - [message getUInt32:&transaction forName:@"wired.transaction"]; - - number = [NSNumber numberWithUnsignedInteger:transaction]; - accounts = [_listedAccounts objectForKey:number]; - - if(!accounts) { - accounts = [NSMutableArray array]; - - [_listedAccounts setObject:accounts forKey:number]; - } - - if([[message name] isEqualToString:@"wired.account.user_list"]) { - [accounts addObject:[WCUserAccount accountWithMessage:message]]; - } - else if([[message name] isEqualToString:@"wired.account.user_list.done"]) { - [_allUserAccounts setArray:accounts]; - - [_listedAccounts removeObjectForKey:number]; - - [[_administration connection] removeObserver:self message:message]; - } - else if([[message name] isEqualToString:@"wired.account.group_list"]) { - [accounts addObject:[WCGroupAccount accountWithMessage:message]]; - } - else if([[message name] isEqualToString:@"wired.account.group_list.done"]) { - [_allGroupAccounts setArray:accounts]; - - [_listedAccounts removeObjectForKey:number]; - - [_progressIndicator stopAnimation:self]; - - [_allAccounts setArray:_allUserAccounts]; - [_allAccounts addObjectsFromArray:_allGroupAccounts]; - [_allAccounts sortUsingSelector:@selector(compareName:)]; - - [self _reloadFilter]; - [self _reloadGroups]; - - [_accountsTableView reloadData]; - - [self _selectAccounts]; - - [[_administration connection] removeObserver:self message:message]; - - [[NSNotificationCenter defaultCenter] postNotificationName:WCAccountsControllerAccountsDidChangeNotification - object:self]; - } - else if([[message name] isEqualToString:@"wired.error"]) { - [_administration showError:[WCError errorWithWiredMessage:message]]; - - [[_administration connection] removeObserver:self message:message]; - } + NSMutableArray *accounts; + NSNumber *number; + WIP7UInt32 transaction; + + [message getUInt32:&transaction forName:@"wired.transaction"]; + + number = [NSNumber numberWithUnsignedInteger:transaction]; + accounts = [_listedAccounts objectForKey:number]; + + if(!accounts) { + accounts = [NSMutableArray array]; + + [_listedAccounts setObject:accounts forKey:number]; + } + + if([[message name] isEqualToString:@"wired.account.user_list"]) { + [accounts addObject:[WCUserAccount accountWithMessage:message]]; + } + else if([[message name] isEqualToString:@"wired.account.user_list.done"]) { + [_allUserAccounts setArray:accounts]; + + [_listedAccounts removeObjectForKey:number]; + + [[_administration connection] removeObserver:self message:message]; + } + else if([[message name] isEqualToString:@"wired.account.group_list"]) { + [accounts addObject:[WCGroupAccount accountWithMessage:message]]; + } + else if([[message name] isEqualToString:@"wired.account.group_list.done"]) { + [_allGroupAccounts setArray:accounts]; + + [_listedAccounts removeObjectForKey:number]; + + [_progressIndicator stopAnimation:self]; + + [_allAccounts setArray:_allUserAccounts]; + [_allAccounts addObjectsFromArray:_allGroupAccounts]; + [_allAccounts sortUsingSelector:@selector(compareName:)]; + + [self _reloadFilter]; + [self _reloadGroups]; + + [_accountsTableView reloadData]; + + [self _selectAccounts]; + + [[_administration connection] removeObserver:self message:message]; + + [[NSNotificationCenter defaultCenter] postNotificationName:WCAccountsControllerAccountsDidChangeNotification + object:self]; + } + else if([[message name] isEqualToString:@"wired.error"]) { + [_administration showError:[WCError errorWithWiredMessage:message]]; + + [[_administration connection] removeObserver:self message:message]; + } } - (void)wiredAccountSubscribeAccountsReply:(WIP7Message *)message { - if([[message name] isEqualToString:@"wired.okay"]) { - [[_administration connection] removeObserver:self message:message]; - - [[_administration connection] removeObserver:self message:message]; - } - else if([[message name] isEqualToString:@"wired.error"]) { - [_administration showError:[WCError errorWithWiredMessage:message]]; - - [[_administration connection] removeObserver:self message:message]; - } + if([[message name] isEqualToString:@"wired.okay"]) { + [[_administration connection] removeObserver:self message:message]; + + [[_administration connection] removeObserver:self message:message]; + } + else if([[message name] isEqualToString:@"wired.error"]) { + [_administration showError:[WCError errorWithWiredMessage:message]]; + + [[_administration connection] removeObserver:self message:message]; + } } - (void)wiredAccountReadAccountReply:(WIP7Message *)message { - NSEnumerator *enumerator; - WCUserAccount *userAccount; - WCAccount *account; - - if([[message name] isEqualToString:@"wired.account.user"] || [[message name] isEqualToString:@"wired.account.group"]) { - if([[message name] isEqualToString:@"wired.account.user"]) - account = [WCUserAccount accountWithMessage:message]; - else - account = [WCGroupAccount accountWithMessage:message]; - - if(_requestedAccounts == [_accounts count]) { - if([account isKindOfClass:[WCGroupAccount class]]) { - enumerator = [_accounts objectEnumerator]; - - while((userAccount = [enumerator nextObject])) { - if([userAccount isKindOfClass:[WCUserAccount class]]) { - if([[userAccount group] isEqualToString:[account name]]) - [userAccount setGroupAccount:(WCGroupAccount *) account]; - } - } - } - - [_progressIndicator stopAnimation:self]; - - [self _validateForAccounts]; - [self _readFromAccounts]; - } else { - [_accounts addObject:account]; - - if([_accounts count] == _requestedAccounts) { - enumerator = [_accounts objectEnumerator]; - - while((userAccount = [enumerator nextObject])) { - if([userAccount isKindOfClass:[WCUserAccount class]]) { - if([[userAccount group] length] > 0) - [self _readAccount:[WCGroupAccount accountWithName:[userAccount group]]]; - } - } - - [_progressIndicator stopAnimation:self]; - - _editing = YES; - - [self _validateForAccounts]; - [self _readFromAccounts]; - } - } - - [[_administration connection] removeObserver:self message:message]; - } - else if([[message name] isEqualToString:@"wired.error"]) { - [_administration showError:[WCError errorWithWiredMessage:message]]; - - [[_administration connection] removeObserver:self message:message]; - } + NSEnumerator *enumerator; + WCUserAccount *userAccount; + WCAccount *account; + + if([[message name] isEqualToString:@"wired.account.user"] || [[message name] isEqualToString:@"wired.account.group"]) { + if([[message name] isEqualToString:@"wired.account.user"]) + account = [WCUserAccount accountWithMessage:message]; + else + account = [WCGroupAccount accountWithMessage:message]; + + if(_requestedAccounts == [_accounts count]) { + if([account isKindOfClass:[WCGroupAccount class]]) { + enumerator = [_accounts objectEnumerator]; + + while((userAccount = [enumerator nextObject])) { + if([userAccount isKindOfClass:[WCUserAccount class]]) { + if([[userAccount group] isEqualToString:[account name]]) + [userAccount setGroupAccount:(WCGroupAccount *) account]; + } + } + } + + [_progressIndicator stopAnimation:self]; + + [self _validateForAccounts]; + [self _readFromAccounts]; + } else { + [_accounts addObject:account]; + + if([_accounts count] == _requestedAccounts) { + enumerator = [_accounts objectEnumerator]; + + while((userAccount = [enumerator nextObject])) { + if([userAccount isKindOfClass:[WCUserAccount class]]) { + if([[userAccount group] length] > 0) + [self _readAccount:[WCGroupAccount accountWithName:[userAccount group]]]; + } + } + + [_progressIndicator stopAnimation:self]; + + _editing = YES; + + [self _validateForAccounts]; + [self _readFromAccounts]; + } + } + + [[_administration connection] removeObserver:self message:message]; + } + else if([[message name] isEqualToString:@"wired.error"]) { + [_administration showError:[WCError errorWithWiredMessage:message]]; + + [[_administration connection] removeObserver:self message:message]; + } } - (void)wiredAccountChangeAccountReply:(WIP7Message *)message { - if([[message name] isEqualToString:@"wired.okay"]) { - [_accounts removeAllObjects]; - - _creating = NO; - _editing = NO; - _touched = NO; - - [self _validateForAccounts]; - [self _readFromAccounts]; - [self _reloadAccounts]; - - [[_administration window] setDocumentEdited:NO]; - - [self _validate]; - - [[_administration connection] removeObserver:self message:message]; - } - else if([[message name] isEqualToString:@"wired.error"]) { - _touched = YES; - - [_administration showError:[WCError errorWithWiredMessage:message]]; - - [[_administration connection] removeObserver:self message:message]; - } + if([[message name] isEqualToString:@"wired.okay"]) { + [_accounts removeAllObjects]; + + _creating = NO; + _editing = NO; + _touched = NO; + + [self _validateForAccounts]; + [self _readFromAccounts]; + [self _reloadAccounts]; + + [[_administration window] setDocumentEdited:NO]; + + [self _validate]; + + [[_administration connection] removeObserver:self message:message]; + } + else if([[message name] isEqualToString:@"wired.error"]) { + _touched = YES; + + [_administration showError:[WCError errorWithWiredMessage:message]]; + + [[_administration connection] removeObserver:self message:message]; + } } - (void)wiredAccountDeleteAccountReply:(WIP7Message *)message { - NSEnumerator *enumerator; - NSArray *accounts; - NSAlert *alert; - NSNumber *key; - NSString *title, *description; - WCError *error; - NSUInteger lastTransaction; - WIP7UInt32 transaction; - - if([[message name] isEqualToString:@"wired.okay"] || [[message name] isEqualToString:@"wired.error"]) { - if([[message name] isEqualToString:@"wired.error"]) - error = [WCError errorWithWiredMessage:message]; - else - error = NULL; - - if([message getUInt32:&transaction forName:@"wired.transaction"]) { - if([[message name] isEqualToString:@"wired.okay"] || [error code] != WCWiredProtocolAccountInUse) - [_deletedAccounts removeObjectForKey:[NSNumber numberWithUnsignedInteger:transaction]]; - - lastTransaction = 0; - enumerator = [_deletedAccounts keyEnumerator]; - - while((key = [enumerator nextObject])) { - if([key unsignedIntegerValue] > lastTransaction) - lastTransaction = [key unsignedIntegerValue]; - } - - if(lastTransaction > 0 && lastTransaction <= transaction) { - accounts = [_deletedAccounts allValues]; - - if([accounts count] == 1) { - title = [NSSWF: - NSLS(@"Are you sure you want to delete \u201c%@\u201d?", @"Delete account dialog title (filename)"), - [[accounts objectAtIndex:0] name]]; - description = NSLS(@"The account is currently used by a logged in user. Deleting it will disconnect the affected user. This cannot be undone.", - @"Delete and disconnect account dialog description"); - } else { - title = [NSSWF: - NSLS(@"Are you sure you want to delete %lu items?", @"Delete and disconnect account dialog title (count)"), - [accounts count]]; - description = NSLS(@"The accounts are currently used by logged in users. Deleting them will disconnect the affected users. This cannot be undone.", - @"Delete and disconnect account dialog description"); - } - - [alert setMessageText:title]; - [alert setInformativeText:description]; - [alert addButtonWithTitle:NSLS(@"Delete & Disconnect", @"Delete and disconnect account dialog button title")]; - [alert addButtonWithTitle:NSLS(@"Cancel", @"Delete and disconnect account dialog button title")]; - [alert beginSheetModalForWindow:[_administration window] - modalDelegate:self - didEndSelector:@selector(deleteAndDisconnectSheetDidEnd:returnCode:contextInfo:) - contextInfo:NULL]; - [alert release]; - } - } - - if(error && [error code] != WCWiredProtocolAccountInUse) - [_administration showError:error]; - - [[_administration connection] removeObserver:self message:message]; - } + NSEnumerator *enumerator; + NSArray *accounts; + NSAlert *alert; + NSNumber *key; + NSString *title, *description; + WCError *error; + NSUInteger lastTransaction; + WIP7UInt32 transaction; + + if([[message name] isEqualToString:@"wired.okay"] || [[message name] isEqualToString:@"wired.error"]) { + if([[message name] isEqualToString:@"wired.error"]) + error = [WCError errorWithWiredMessage:message]; + else + error = NULL; + + if([message getUInt32:&transaction forName:@"wired.transaction"]) { + if([[message name] isEqualToString:@"wired.okay"] || [error code] != WCWiredProtocolAccountInUse) + [_deletedAccounts removeObjectForKey:[NSNumber numberWithUnsignedInteger:transaction]]; + + lastTransaction = 0; + enumerator = [_deletedAccounts keyEnumerator]; + + while((key = [enumerator nextObject])) { + if([key unsignedIntegerValue] > lastTransaction) + lastTransaction = [key unsignedIntegerValue]; + } + + if(lastTransaction > 0 && lastTransaction <= transaction) { + accounts = [_deletedAccounts allValues]; + + if([accounts count] == 1) { + title = [NSSWF: + NSLS(@"Are you sure you want to delete \u201c%@\u201d?", @"Delete account dialog title (filename)"), + [[accounts objectAtIndex:0] name]]; + description = NSLS(@"The account is currently used by a logged in user. Deleting it will disconnect the affected user. This cannot be undone.", + @"Delete and disconnect account dialog description"); + } else { + title = [NSSWF: + NSLS(@"Are you sure you want to delete %lu items?", @"Delete and disconnect account dialog title (count)"), + [accounts count]]; + description = NSLS(@"The accounts are currently used by logged in users. Deleting them will disconnect the affected users. This cannot be undone.", + @"Delete and disconnect account dialog description"); + } + + [alert setMessageText:title]; + [alert setInformativeText:description]; + [alert addButtonWithTitle:NSLS(@"Delete & Disconnect", @"Delete and disconnect account dialog button title")]; + [alert addButtonWithTitle:NSLS(@"Cancel", @"Delete and disconnect account dialog button title")]; + [alert beginSheetModalForWindow:[_administration window] + modalDelegate:self + didEndSelector:@selector(deleteAndDisconnectSheetDidEnd:returnCode:contextInfo:) + contextInfo:NULL]; + [alert release]; + } + } + + if(error && [error code] != WCWiredProtocolAccountInUse) + [_administration showError:error]; + + [[_administration connection] removeObserver:self message:message]; + } } - (void)textDidChange:(NSNotification *)notification { - [self touch:self]; + [self touch:self]; } - (void)controlTextDidChange:(NSNotification *)notification { - [self touch:self]; + [self touch:self]; } - (NSArray *)tokenField:(NSTokenField *)tokenField completionsForSubstring:(NSString *)substring indexOfToken:(NSInteger)tokenIndex indexOfSelectedItem:(NSInteger *)selectedIndex { - NSEnumerator *enumerator; - NSMutableArray *array; - WCAccount *account; - - array = [NSMutableArray array]; - enumerator = [_allAccounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - if([account isKindOfClass:[WCGroupAccount class]] && [[account name] hasPrefix:substring]) - [array addObject:[account name]]; - } - - return array; + NSEnumerator *enumerator; + NSMutableArray *array; + WCAccount *account; + + array = [NSMutableArray array]; + enumerator = [_allAccounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + if([account isKindOfClass:[WCGroupAccount class]] && [[account name] hasPrefix:substring]) + [array addObject:[account name]]; + } + + return array; } #pragma mark - - (BOOL)validateMenuItem:(NSMenuItem *)item { - SEL selector; - - selector = [item action]; - - if(selector == @selector(newDocument:)) - return [self _validateAddAccount]; - else if(selector == @selector(deleteDocument:)) - return [self _validateDeleteAccount]; - else if(selector == @selector(duplicateAccount:)) - return [self _validateDuplicateAccount]; - - return YES; + SEL selector; + + selector = [item action]; + + if(selector == @selector(newDocument:)) + return [self _validateAddAccount]; + else if(selector == @selector(deleteDocument:)) + return [self _validateDeleteAccount]; + else if(selector == @selector(duplicateAccount:)) + return [self _validateDuplicateAccount]; + + return YES; +} + +#pragma mark - + +- (void)appleInterfaceThemeChanged:(NSNotification *)notification { + [self _reloadColorsPopUpButtonMenu]; } #pragma mark - - (BOOL)controllerWindowShouldClose { - return [self _verifyUnsavedAndPerformAction:WCAccountsCloseWindow argument:NULL]; + return [self _verifyUnsavedAndPerformAction:WCAccountsCloseWindow argument:NULL]; } - (void)controllerDidSelect { - [self _requestAccounts]; - - [[_administration window] makeFirstResponder:_accountsTableView]; + [self _requestAccounts]; + + [[_administration window] makeFirstResponder:_accountsTableView]; } - (BOOL)controllerShouldUnselectForNewController:(id)controller { - return [self _verifyUnsavedAndPerformAction:WCAccountsSelectTab argument:controller]; + return [self _verifyUnsavedAndPerformAction:WCAccountsSelectTab argument:controller]; } #pragma mark - - (NSSize)minimumWindowSize { - return NSMakeSize(678.0, 571.0); + return NSMakeSize(678.0, 571.0); } #pragma mark - - (NSString *)newDocumentMenuItemTitle { - return NSLS(@"New Account\u2026", @"New menu item"); + return NSLS(@"New Account\u2026", @"New menu item"); } - (NSString *)deleteDocumentMenuItemTitle { - NSArray *accounts; - - accounts = [self _selectedAccounts]; - - switch([accounts count]) { - case 0: - return NSLS(@"Delete Account\u2026", @"Delete menu item"); - break; - - case 1: - return [NSSWF:NSLS(@"Delete \u201c%@\u201d\u2026", @"Delete menu item (account)"), [[accounts objectAtIndex:0] name]]; - break; - - default: - return [NSSWF:NSLS(@"Delete %u Items\u2026", @"Delete menu item (count)"), [accounts count]]; - break; - } + NSArray *accounts; + + accounts = [self _selectedAccounts]; + + switch([accounts count]) { + case 0: + return NSLS(@"Delete Account\u2026", @"Delete menu item"); + break; + + case 1: + return [NSSWF:NSLS(@"Delete \u201c%@\u201d\u2026", @"Delete menu item (account)"), [[accounts objectAtIndex:0] name]]; + break; + + default: + return [NSSWF:NSLS(@"Delete %u Items\u2026", @"Delete menu item (count)"), [accounts count]]; + break; + } } #pragma mark - - (NSArray *)userNames { - NSEnumerator *enumerator; - NSMutableArray *array; - WCAccount *account; - - if(_requested) { - array = [NSMutableArray array]; - enumerator = [_allUserAccounts objectEnumerator]; - - while((account = [enumerator nextObject])) - [array addObject:[account name]]; - - [array sortUsingSelector:@selector(caseInsensitiveCompare:)]; - - return array; - } else { - [self _requestAccounts]; - - if(_requested) - return nil; - else - return [NSArray array]; - } + NSEnumerator *enumerator; + NSMutableArray *array; + WCAccount *account; + + if(_requested) { + array = [NSMutableArray array]; + enumerator = [_allUserAccounts objectEnumerator]; + + while((account = [enumerator nextObject])) + [array addObject:[account name]]; + + [array sortUsingSelector:@selector(caseInsensitiveCompare:)]; + + return array; + } else { + [self _requestAccounts]; + + if(_requested) + return nil; + else + return [NSArray array]; + } } - (NSArray *)groupNames { - NSEnumerator *enumerator; - NSMutableArray *array; - WCAccount *account; - - if(_requested) { - array = [NSMutableArray array]; - enumerator = [_allGroupAccounts objectEnumerator]; - - while((account = [enumerator nextObject])) - [array addObject:[account name]]; - - [array sortUsingSelector:@selector(caseInsensitiveCompare:)]; - - return array; - } else { - [self _requestAccounts]; - - if(_requested) - return nil; - else - return [NSArray array]; - } + NSEnumerator *enumerator; + NSMutableArray *array; + WCAccount *account; + + if(_requested) { + array = [NSMutableArray array]; + enumerator = [_allGroupAccounts objectEnumerator]; + + while((account = [enumerator nextObject])) + [array addObject:[account name]]; + + [array sortUsingSelector:@selector(caseInsensitiveCompare:)]; + + return array; + } else { + [self _requestAccounts]; + + if(_requested) + return nil; + else + return [NSArray array]; + } } - (void)editUserAccountWithName:(NSString *)name { - WCAccount *account; - NSInteger i, count; - - count = [_shownAccounts count]; - - for(i = 0; i < count; i++) { - account = [_shownAccounts objectAtIndex:i]; - - if([account isKindOfClass:[WCUserAccount class]] && [[account name]isEqualToString:name]) { - [_accountsTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:i] byExtendingSelection:NO]; - - break; - } - } - - [_administration selectController:self]; - [_administration showWindow:self]; + WCAccount *account; + NSInteger i, count; + + count = [_shownAccounts count]; + + for(i = 0; i < count; i++) { + account = [_shownAccounts objectAtIndex:i]; + + if([account isKindOfClass:[WCUserAccount class]] && [[account name]isEqualToString:name]) { + [_accountsTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:i] byExtendingSelection:NO]; + + break; + } + } + + [_administration selectController:self]; + [_administration showWindow:self]; } #pragma mark - - (IBAction)newDocument:(id)sender { - [self addAccount:sender]; + [self addAccount:sender]; } - (IBAction)deleteDocument:(id)sender { - [self deleteAccount:sender]; + [self deleteAccount:sender]; } - (IBAction)touch:(id)sender { - _touched = YES; + _touched = YES; - [[_administration window] setDocumentEdited:YES]; - - [self _validate]; + [[_administration window] setDocumentEdited:YES]; + + [self _validate]; } - (IBAction)addAccount:(id)sender { - WCUserAccount *account; - - if(![self _validateAddAccount]) - return; - - [_accounts removeAllObjects]; - - [self _readFromAccounts]; - - account = [[[WCUserAccount alloc] init] autorelease]; - [account setName:NSLS(@"Untitled", @"Account name")]; - [_accounts addObject:account]; - - _creating = YES; - _editing = NO; - _touched = YES; - - [_accountsTabView selectTabViewItemAtIndex:0]; - - if([[[_administration connection] account] accountCreateUsers]) - [_typePopUpButton selectItem:_userMenuItem]; - else - [_typePopUpButton selectItem:_groupMenuItem]; - - [_nameTextField setStringValue:[account name]]; - - [self _validate]; - [self _validateForAccounts]; - [self _readFromAccounts]; - - [[_administration window] setDocumentEdited:YES]; - - [[_administration window] makeFirstResponder:_nameTextField]; - [_nameTextField selectText:self]; + WCUserAccount *account; + + if(![self _validateAddAccount]) + return; + + [_accounts removeAllObjects]; + + [self _readFromAccounts]; + + account = [[[WCUserAccount alloc] init] autorelease]; + [account setName:NSLS(@"Untitled", @"Account name")]; + [_accounts addObject:account]; + + _creating = YES; + _editing = NO; + _touched = YES; + + [_accountsTabView selectTabViewItemAtIndex:0]; + + if([[[_administration connection] account] accountCreateUsers]) + [_typePopUpButton selectItem:_userMenuItem]; + else + [_typePopUpButton selectItem:_groupMenuItem]; + + [_nameTextField setStringValue:[account name]]; + + [self _validate]; + [self _validateForAccounts]; + [self _readFromAccounts]; + + [[_administration window] setDocumentEdited:YES]; + + [[_administration window] makeFirstResponder:_nameTextField]; + [_nameTextField selectText:self]; } - (IBAction)deleteAccount:(id)sender { - NSAlert *alert; - NSArray *accounts; - NSString *title; - - if(![self _validateDeleteAccount]) - return; - - accounts = [self _selectedAccounts]; - - if([accounts count] == 1) { - title = [NSSWF: - NSLS(@"Are you sure you want to delete \u201c%@\u201d?", @"Delete account dialog title (filename)"), - [[accounts objectAtIndex:0] name]]; - } else { - title = [NSSWF: - NSLS(@"Are you sure you want to delete %lu items?", @"Delete account dialog title (count)"), - [accounts count]]; - } - - alert = [[NSAlert alloc] init]; - [alert setMessageText:title]; - [alert setInformativeText:NSLS(@"This cannot be undone.", @"Delete account dialog description")]; - [alert addButtonWithTitle:NSLS(@"Delete", @"Delete account dialog button title")]; - [alert addButtonWithTitle:NSLS(@"Cancel", @"Delete account dialog button title")]; - [alert beginSheetModalForWindow:[_administration window] - modalDelegate:self - didEndSelector:@selector(deleteSheetDidEnd:returnCode:contextInfo:) - contextInfo:NULL]; - [alert release]; + NSAlert *alert; + NSArray *accounts; + NSString *title; + + if(![self _validateDeleteAccount]) + return; + + accounts = [self _selectedAccounts]; + + if([accounts count] == 1) { + title = [NSSWF: + NSLS(@"Are you sure you want to delete \u201c%@\u201d?", @"Delete account dialog title (filename)"), + [[accounts objectAtIndex:0] name]]; + } else { + title = [NSSWF: + NSLS(@"Are you sure you want to delete %lu items?", @"Delete account dialog title (count)"), + [accounts count]]; + } + + alert = [[NSAlert alloc] init]; + [alert setMessageText:title]; + [alert setInformativeText:NSLS(@"This cannot be undone.", @"Delete account dialog description")]; + [alert addButtonWithTitle:NSLS(@"Delete", @"Delete account dialog button title")]; + [alert addButtonWithTitle:NSLS(@"Cancel", @"Delete account dialog button title")]; + [alert beginSheetModalForWindow:[_administration window] + modalDelegate:self + didEndSelector:@selector(deleteSheetDidEnd:returnCode:contextInfo:) + contextInfo:NULL]; + [alert release]; } - (void)deleteSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { - NSEnumerator *enumerator; - WIP7Message *message; - WCAccount *account; - NSUInteger transaction; - - if(returnCode == NSAlertFirstButtonReturn) { - enumerator = [[self _selectedAccounts] objectEnumerator]; - - while((account = [enumerator nextObject])) { - if([account isKindOfClass:[WCUserAccount class]]) { - message = [WIP7Message messageWithName:@"wired.account.delete_user" spec:WCP7Spec]; - [message setBool:NO forName:@"wired.account.disconnect_users"]; - } else { - message = [WIP7Message messageWithName:@"wired.account.delete_group" spec:WCP7Spec]; - } - - [message setString:[account name] forName:@"wired.account.name"]; - - transaction = [[_administration connection] sendMessage:message - fromObserver:self - selector:@selector(wiredAccountDeleteAccountReply:)]; - - [_deletedAccounts setObject:account forKey:[NSNumber numberWithUnsignedInteger:transaction]]; - } - } + NSEnumerator *enumerator; + WIP7Message *message; + WCAccount *account; + NSUInteger transaction; + + if(returnCode == NSAlertFirstButtonReturn) { + enumerator = [[self _selectedAccounts] objectEnumerator]; + + while((account = [enumerator nextObject])) { + if([account isKindOfClass:[WCUserAccount class]]) { + message = [WIP7Message messageWithName:@"wired.account.delete_user" spec:WCP7Spec]; + [message setBool:NO forName:@"wired.account.disconnect_users"]; + } else { + message = [WIP7Message messageWithName:@"wired.account.delete_group" spec:WCP7Spec]; + } + + [message setString:[account name] forName:@"wired.account.name"]; + + transaction = [[_administration connection] sendMessage:message + fromObserver:self + selector:@selector(wiredAccountDeleteAccountReply:)]; + + [_deletedAccounts setObject:account forKey:[NSNumber numberWithUnsignedInteger:transaction]]; + } + } } - (void)deleteAndDisconnectSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { - NSEnumerator *enumerator; - WIP7Message *message; - WCAccount *account; - - if(returnCode == NSAlertFirstButtonReturn) { - enumerator = [_deletedAccounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - if([account isKindOfClass:[WCUserAccount class]]) { - message = [WIP7Message messageWithName:@"wired.account.delete_user" spec:WCP7Spec]; - [message setBool:YES forName:@"wired.account.disconnect_users"]; - } else { - message = [WIP7Message messageWithName:@"wired.account.delete_group" spec:WCP7Spec]; - } - - [message setString:[account name] forName:@"wired.account.name"]; - - [[_administration connection] sendMessage:message - fromObserver:self - selector:@selector(wiredAccountDeleteAccountReply:)]; - } - } - - [_deletedAccounts removeAllObjects]; + NSEnumerator *enumerator; + WIP7Message *message; + WCAccount *account; + + if(returnCode == NSAlertFirstButtonReturn) { + enumerator = [_deletedAccounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + if([account isKindOfClass:[WCUserAccount class]]) { + message = [WIP7Message messageWithName:@"wired.account.delete_user" spec:WCP7Spec]; + [message setBool:YES forName:@"wired.account.disconnect_users"]; + } else { + message = [WIP7Message messageWithName:@"wired.account.delete_group" spec:WCP7Spec]; + } + + [message setString:[account name] forName:@"wired.account.name"]; + + [[_administration connection] sendMessage:message + fromObserver:self + selector:@selector(wiredAccountDeleteAccountReply:)]; + } + } + + [_deletedAccounts removeAllObjects]; } - (IBAction)duplicateAccount:(id)sender { - NSArray *names; - WCAccount *account; - - if(![self _validateDuplicateAccount]) - return; - - account = [[[_accounts objectAtIndex:0] copy] autorelease]; - names = [account isKindOfClass:[WCUserAccount class]] ? [self userNames] : [self groupNames]; - - [account setName:[WCApplicationController copiedNameForName:[account name] existingNames:names]]; - - [[_administration connection] sendMessage:[account createAccountMessage] - fromObserver:self - selector:@selector(wiredAccountChangeAccountReply:)]; - - [_selectAccounts setArray:[NSArray arrayWithObject:account]]; + NSArray *names; + WCAccount *account; + + if(![self _validateDuplicateAccount]) + return; + + account = [[[_accounts objectAtIndex:0] copy] autorelease]; + names = [account isKindOfClass:[WCUserAccount class]] ? [self userNames] : [self groupNames]; + + [account setName:[WCApplicationController copiedNameForName:[account name] existingNames:names]]; + + [[_administration connection] sendMessage:[account createAccountMessage] + fromObserver:self + selector:@selector(wiredAccountChangeAccountReply:)]; + + [_selectAccounts setArray:[NSArray arrayWithObject:account]]; } - (IBAction)all:(id)sender { - [_usersFilterButton setState:NSOffState]; - [_groupsFilterButton setState:NSOffState]; - - [_selectAccounts setArray:[self _selectedAccounts]]; - - [self _reloadFilter]; + [_usersFilterButton setState:NSOffState]; + [_groupsFilterButton setState:NSOffState]; + + [_selectAccounts setArray:[self _selectedAccounts]]; + + [self _reloadFilter]; - [_accountsTableView reloadData]; - - [self _selectAccounts]; + [_accountsTableView reloadData]; + + [self _selectAccounts]; } - (IBAction)users:(id)sender { - [_allFilterButton setState:NSOffState]; - [_groupsFilterButton setState:NSOffState]; - - [_selectAccounts setArray:[self _selectedAccounts]]; - - [self _reloadFilter]; - - [_accountsTableView reloadData]; - - [self _selectAccounts]; + [_allFilterButton setState:NSOffState]; + [_groupsFilterButton setState:NSOffState]; + + [_selectAccounts setArray:[self _selectedAccounts]]; + + [self _reloadFilter]; + + [_accountsTableView reloadData]; + + [self _selectAccounts]; } - (IBAction)groups:(id)sender { - [_usersFilterButton setState:NSOffState]; - [_allFilterButton setState:NSOffState]; + [_usersFilterButton setState:NSOffState]; + [_allFilterButton setState:NSOffState]; - [_selectAccounts setArray:[self _selectedAccounts]]; - - [self _reloadFilter]; - - [_accountsTableView reloadData]; - - [self _selectAccounts]; + [_selectAccounts setArray:[self _selectedAccounts]]; + + [self _reloadFilter]; + + [_accountsTableView reloadData]; + + [self _selectAccounts]; } - (IBAction)groupFilter:(id)sender { - [_selectAccounts setArray:[self _selectedAccounts]]; - - [self _reloadFilter]; - - [_accountsTableView reloadData]; - - [self _selectAccounts]; + [_selectAccounts setArray:[self _selectedAccounts]]; + + [self _reloadFilter]; + + [_accountsTableView reloadData]; + + [self _selectAccounts]; } - (IBAction)search:(id)sender { - [_accountFilter release]; - - if([[_filterSearchField stringValue] length] > 0) - _accountFilter = [[_filterSearchField stringValue] retain]; - else - _accountFilter = NULL; - - [_selectAccounts setArray:[self _selectedAccounts]]; - - [self _reloadFilter]; - - [_accountsTableView reloadData]; - - [self _selectAccounts]; + [_accountFilter release]; + + if([[_filterSearchField stringValue] length] > 0) + _accountFilter = [[_filterSearchField stringValue] retain]; + else + _accountFilter = NULL; + + [_selectAccounts setArray:[self _selectedAccounts]]; + + [self _reloadFilter]; + + [_accountsTableView reloadData]; + + [self _selectAccounts]; } - (IBAction)type:(id)sender { - WCUserAccount *userAccount; - - if(_creating) { - if([_typePopUpButton selectedItem] == _groupMenuItem) { - [_groupPopUpButton selectItemAtIndex:0]; - - userAccount = [_accounts lastObject]; - - [userAccount setGroup:@""]; - [userAccount setGroupAccount:NULL]; - } - } - - [self _validateForAccounts]; + WCUserAccount *userAccount; + + if(_creating) { + if([_typePopUpButton selectedItem] == _groupMenuItem) { + [_groupPopUpButton selectItemAtIndex:0]; + + userAccount = [_accounts lastObject]; + + [userAccount setGroup:@""]; + [userAccount setGroupAccount:NULL]; + } + } + + [self _validateForAccounts]; } - (IBAction)group:(id)sender { - NSEnumerator *enumerator; - WCUserAccount *account; - - if([_typePopUpButton selectedItem] == _userMenuItem) { - enumerator = [_accounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - if([_groupPopUpButton selectedItem] == _dontChangeGroupMenuItem) { - [account setGroup:[account originalGroup]]; - [account setGroupAccount:NULL]; - } - else if([_groupPopUpButton selectedItem] == _noneMenuItem) { - [account setGroup:@""]; - [account setGroupAccount:NULL]; - } - else { - [account setGroup:[_groupPopUpButton titleOfSelectedItem]]; - } - - if([[account group] length] > 0) - [self _readAccount:[WCGroupAccount accountWithName:[account group]]]; - } - - [_settingsOutlineView reloadData]; - - [self touch:self]; - } else { - [_groupPopUpButton selectItemAtIndex:0]; - } + NSEnumerator *enumerator; + WCUserAccount *account; + + if([_typePopUpButton selectedItem] == _userMenuItem) { + enumerator = [_accounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + if([_groupPopUpButton selectedItem] == _dontChangeGroupMenuItem) { + [account setGroup:[account originalGroup]]; + [account setGroupAccount:NULL]; + } + else if([_groupPopUpButton selectedItem] == _noneMenuItem) { + [account setGroup:@""]; + [account setGroupAccount:NULL]; + } + else { + [account setGroup:[_groupPopUpButton titleOfSelectedItem]]; + } + + if([[account group] length] > 0) + [self _readAccount:[WCGroupAccount accountWithName:[account group]]]; + } + + [_settingsOutlineView reloadData]; + + [self touch:self]; + } else { + [_groupPopUpButton selectItemAtIndex:0]; + } } - (IBAction)show:(id)sender { - [self _reloadSettings]; + [self _reloadSettings]; } - (IBAction)selectAll:(id)sender { - NSEnumerator *enumerator, *settingsEnumerator, *accountsEnumerator; - NSDictionary *section, *setting; - WCAccount *account; - - enumerator = [_shownSettings objectEnumerator]; - - while((section = [enumerator nextObject])) { - settingsEnumerator = [[section objectForKey:WCAccountsFieldSettings] objectEnumerator]; - - while((setting = [settingsEnumerator nextObject])) { - if([[setting objectForKey:WCAccountFieldTypeKey] integerValue] == WCAccountFieldTypeBoolean) { - accountsEnumerator = [_accounts objectEnumerator]; - - while((account = [accountsEnumerator nextObject])) - [account setValue:[NSNumber numberWithBool:YES] forKey:[setting objectForKey:WCAccountFieldNameKey]]; - } - } - } - - [_settingsOutlineView reloadData]; - - [self touch:self]; + NSEnumerator *enumerator, *settingsEnumerator, *accountsEnumerator; + NSDictionary *section, *setting; + WCAccount *account; + + enumerator = [_shownSettings objectEnumerator]; + + while((section = [enumerator nextObject])) { + settingsEnumerator = [[section objectForKey:WCAccountsFieldSettings] objectEnumerator]; + + while((setting = [settingsEnumerator nextObject])) { + if([[setting objectForKey:WCAccountFieldTypeKey] integerValue] == WCAccountFieldTypeBoolean) { + accountsEnumerator = [_accounts objectEnumerator]; + + while((account = [accountsEnumerator nextObject])) + [account setValue:[NSNumber numberWithBool:YES] forKey:[setting objectForKey:WCAccountFieldNameKey]]; + } + } + } + + [_settingsOutlineView reloadData]; + + [self touch:self]; } - (IBAction)clearSetting:(id)sender { - NSEnumerator *enumerator; - NSDictionary *setting; - NSString *name; -// NSIndexSet *indexes; - WCAccount *account; - NSInteger index; - BOOL changed = NO; - -// indexes = [_settingsOutlineView selectedRowIndexes]; -// index = [indexes firstIndex]; + NSEnumerator *enumerator; + NSDictionary *setting; + NSString *name; +// NSIndexSet *indexes; + WCAccount *account; + NSInteger index; + BOOL changed = NO; + +// indexes = [_settingsOutlineView selectedRowIndexes]; +// index = [indexes firstIndex]; for(index = 0; index < [_settingsOutlineView numberOfRows]; index++) { - setting = [_settingsOutlineView itemAtRow:index]; - name = [setting objectForKey:WCAccountFieldNameKey]; - - if(name) { - enumerator = [_accounts objectEnumerator]; - - while((account = [enumerator nextObject])) - [account setValue:NULL forKey:name]; - - changed = YES; - } - - //index = [indexes indexGreaterThanIndex:index]; + setting = [_settingsOutlineView itemAtRow:index]; + name = [setting objectForKey:WCAccountFieldNameKey]; + + if(name) { + enumerator = [_accounts objectEnumerator]; + + while((account = [enumerator nextObject])) + [account setValue:NULL forKey:name]; + + changed = YES; + } + + //index = [indexes indexGreaterThanIndex:index]; } - if(changed) { - [self touch:self]; - - if([_showPopUpButton selectedItem] == _settingsDefinedAtThisLevelMenuItem) - [self _reloadSettings]; - - [_settingsOutlineView reloadData]; - } + if(changed) { + [self touch:self]; + + if([_showPopUpButton selectedItem] == _settingsDefinedAtThisLevelMenuItem) + [self _reloadSettings]; + + [_settingsOutlineView reloadData]; + } } - (IBAction)save:(id)sender { - [[_administration window] makeFirstResponder:_accountsTableView]; - - [self _save]; + [[_administration window] makeFirstResponder:_accountsTableView]; + + [self _save]; } - (void)saveSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { - NSDictionary *dictionary = contextInfo; - id argument; - WCAccountsAction action; - - action = [[dictionary objectForKey:@"WCAccountsAction"] integerValue]; - argument = [dictionary objectForKey:@"WCAccountsArgument"]; - - if(returnCode != NSAlertSecondButtonReturn) { - if(returnCode == NSAlertFirstButtonReturn) { - [self _save]; - - [_selectAccounts removeAllObjects]; - } else { - [_accounts removeAllObjects]; - - _creating = NO; - _editing = NO; - - [self _validateForAccounts]; - [self _readFromAccounts]; - - [[_administration window] setDocumentEdited:NO]; - - [self _validate]; - } - - _touched = NO; - - switch(action) { - case WCAccountsDoNothing: - default: - break; - - case WCAccountsCloseWindow: - [_accountsTableView deselectAll:self]; - - [_administration close]; - break; - - case WCAccountsSelectTab: - [_accountsTableView deselectAll:self]; - - [_administration selectController:argument]; - break; - - case WCAccountsSelectRow: - [_selectAccounts removeAllObjects]; - - [_accountsTableView selectRowIndexes:argument byExtendingSelection:NO]; - break; - } - } - - _saving = NO; - [dictionary release]; + NSDictionary *dictionary = contextInfo; + id argument; + WCAccountsAction action; + + action = [[dictionary objectForKey:@"WCAccountsAction"] integerValue]; + argument = [dictionary objectForKey:@"WCAccountsArgument"]; + + if(returnCode != NSAlertSecondButtonReturn) { + if(returnCode == NSAlertFirstButtonReturn) { + [self _save]; + + [_selectAccounts removeAllObjects]; + } else { + [_accounts removeAllObjects]; + + _creating = NO; + _editing = NO; + + [self _validateForAccounts]; + [self _readFromAccounts]; + + [[_administration window] setDocumentEdited:NO]; + + [self _validate]; + } + + _touched = NO; + + switch(action) { + case WCAccountsDoNothing: + default: + break; + + case WCAccountsCloseWindow: + [_accountsTableView deselectAll:self]; + + [_administration close]; + break; + + case WCAccountsSelectTab: + [_accountsTableView deselectAll:self]; + + [_administration selectController:argument]; + break; + + case WCAccountsSelectRow: + [_selectAccounts removeAllObjects]; + + [_accountsTableView selectRowIndexes:argument byExtendingSelection:NO]; + break; + } + } + + _saving = NO; + [dictionary release]; } @@ -2013,67 +2044,67 @@ - (void)saveSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode conte #pragma mark - - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { - return [_shownAccounts count]; + return [_shownAccounts count]; } - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { - WCAccount *account; + WCAccount *account; - account = [self _accountAtIndex:row]; + account = [self _accountAtIndex:row]; - return [account name]; + return [account name]; } - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { - WCAccount *account; - - account = [self _accountAtIndex:row]; - - if([account isKindOfClass:[WCUserAccount class]]) - [cell setImage:_userImage]; - else - [cell setImage:_groupImage]; - - [cell setTextColor:[WCUser colorForColor:[account color] idleTint:NO]]; + WCAccount *account; + + account = [self _accountAtIndex:row]; + + if([account isKindOfClass:[WCUserAccount class]]) + [cell setImage:_userImage]; + else + [cell setImage:_groupImage]; + + [cell setTextColor:[WCUser colorForColor:[account color] idleTint:NO]]; } - (NSString *)tableView:(NSTableView *)tableView stringValueForRow:(NSInteger)row { - return [[self _accountAtIndex:row] name]; + return [[self _accountAtIndex:row] name]; } - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row { - if(row != [_accountsTableView selectedRow]) - return [self _verifyUnsavedAndPerformAction:WCAccountsSelectRow argument:[NSIndexSet indexSetWithIndex:row]]; - - return YES; + if(row != [_accountsTableView selectedRow]) + return [self _verifyUnsavedAndPerformAction:WCAccountsSelectRow argument:[NSIndexSet indexSetWithIndex:row]]; + + return YES; } - (void)tableViewSelectionDidChange:(NSNotification *)notification { - if([self _verifyUnsavedAndPerformAction:WCAccountsDoNothing argument:NULL]) { - if([[[_administration connection] account] accountReadAccounts]) { - if([_accountsTableView numberOfSelectedRows] > 0) { - [self _readAccounts:[self _selectedAccounts]]; - } else { - [_accounts removeAllObjects]; - - _editing = _creating = NO; + if([self _verifyUnsavedAndPerformAction:WCAccountsDoNothing argument:NULL]) { + if([[[_administration connection] account] accountReadAccounts]) { + if([_accountsTableView numberOfSelectedRows] > 0) { + [self _readAccounts:[self _selectedAccounts]]; + } else { + [_accounts removeAllObjects]; + + _editing = _creating = NO; - [self _validateForAccounts]; - [self _readFromAccounts]; - } - } - - [self _validate]; - } + [self _validateForAccounts]; + [self _readFromAccounts]; + } + } + + [self _validate]; + } } @@ -2081,241 +2112,241 @@ - (void)tableViewSelectionDidChange:(NSNotification *)notification { #pragma mark - - (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { - if([_accounts count] == 0) - return 0; - - if(!item) - return [_shownSettings count]; - - return [[item objectForKey:WCAccountsFieldSettings] count]; + if([_accounts count] == 0) + return 0; + + if(!item) + return [_shownSettings count]; + + return [[item objectForKey:WCAccountsFieldSettings] count]; } - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item { - if(!item) - return [_shownSettings objectAtIndex:index]; - - return [[item objectForKey:WCAccountsFieldSettings] objectAtIndex:index]; + if(!item) + return [_shownSettings objectAtIndex:index]; + + return [[item objectForKey:WCAccountsFieldSettings] objectAtIndex:index]; } - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { - NSEnumerator *enumerator; - NSMutableSet *values; - NSAttributedString *attributedString; - NSDictionary *attributes; - NSString *name; - WCAccount *account; - id cell, value; - WCAccountFieldType type; - - if(tableColumn == _settingTableColumn) { - return [item objectForKey:WCAccountFieldLocalizedNameKey]; - } - else if(tableColumn == _valueTableColumn) { - type = [[item objectForKey:WCAccountFieldTypeKey] integerValue]; - name = [item objectForKey:WCAccountFieldNameKey]; - cell = [item objectForKey:WCAccountsFieldCell]; - - if(!name) - return NULL; - - if(type == WCAccountFieldTypeEnum) { - if([[(NSPopUpButton*)cell itemAtIndex:0] tag] == -1) { - [cell removeItemAtIndex:0]; - [cell removeItemAtIndex:0]; - } - } - - if([_accounts count] == 1) { - account = [_accounts lastObject]; - value = [account valueForKey:name]; - + NSEnumerator *enumerator; + NSMutableSet *values; + NSAttributedString *attributedString; + NSDictionary *attributes; + NSString *name; + WCAccount *account; + id cell, value; + WCAccountFieldType type; + + if(tableColumn == _settingTableColumn) { + return [item objectForKey:WCAccountFieldLocalizedNameKey]; + } + else if(tableColumn == _valueTableColumn) { + type = [[item objectForKey:WCAccountFieldTypeKey] integerValue]; + name = [item objectForKey:WCAccountFieldNameKey]; + cell = [item objectForKey:WCAccountsFieldCell]; + + if(!name) + return NULL; + + if(type == WCAccountFieldTypeEnum) { + if([[(NSPopUpButton*)cell itemAtIndex:0] tag] == -1) { + [cell removeItemAtIndex:0]; + [cell removeItemAtIndex:0]; + } + } + + if([_accounts count] == 1) { + account = [_accounts lastObject]; + value = [account valueForKey:name]; + if(!value && [account isKindOfClass:[WCUserAccount class]]) - value = [[(WCUserAccount *) account groupAccount] valueForKey:name]; + value = [[(WCUserAccount *) account groupAccount] valueForKey:name]; - } else { - values = [NSMutableSet set]; - enumerator = [_accounts objectEnumerator]; - - while((account = [enumerator nextObject])) { - value = [account valueForKey:name]; - - if(!value) { - switch(type) { - case WCAccountFieldTypeString: - value = @""; - break; - case WCAccountFieldTypeDate: - value = [NSDate date]; - break; - case WCAccountFieldTypeNumber: - value = [NSNumber numberWithInteger:0]; - break; - case WCAccountFieldTypeBoolean: - value = [NSNumber numberWithBool:0]; - break; - case WCAccountFieldTypeEnum: - value = [NSNumber numberWithInteger:-1]; - break; - case WCAccountFieldTypeList: - value = [NSArray array]; - break; - } - } - - [values addObject:value]; - } - - if([values count] == 1) { - value = [values anyObject]; - } - else if([values count] == 0) { - value = NULL; - } - else { - attributes = [NSDictionary dictionaryWithObjectsAndKeys: - [NSColor grayColor], NSForegroundColorAttributeName, - [cell font], NSFontAttributeName, - NULL]; - attributedString = [NSAttributedString attributedStringWithString:NSLS(@"", @"Account field value") - attributes:attributes]; - - if(type == WCAccountFieldTypeBoolean) - value = [NSNumber numberWithInteger:NSMixedState]; - else if(type == WCAccountFieldTypeEnum) { - [cell insertItem:[NSMenuItem itemWithAttributedTitle:attributedString tag:-1] atIndex:0]; - [cell insertItem:[NSMenuItem separatorItem] atIndex:1]; - - value = [NSNumber numberWithInteger:0]; - } - else { - value = [attributedString string]; - } - } - } - - if([name isEqualToString:@"wired.account.transfer.download_speed_limit"] || - [name isEqualToString:@"wired.account.transfer.upload_speed_limit"]) { - if([value isKindOfClass:[NSNumber class]]) - value = [NSNumber numberWithInteger:[value doubleValue] / 1024.0]; - } - - if(type == WCAccountFieldTypeNumber && [value isKindOfClass:[NSNumber class]] && [value integerValue] == 0) - value = NULL; - - return value; - } - - return NULL; + } else { + values = [NSMutableSet set]; + enumerator = [_accounts objectEnumerator]; + + while((account = [enumerator nextObject])) { + value = [account valueForKey:name]; + + if(!value) { + switch(type) { + case WCAccountFieldTypeString: + value = @""; + break; + case WCAccountFieldTypeDate: + value = [NSDate date]; + break; + case WCAccountFieldTypeNumber: + value = [NSNumber numberWithInteger:0]; + break; + case WCAccountFieldTypeBoolean: + value = [NSNumber numberWithBool:0]; + break; + case WCAccountFieldTypeEnum: + value = [NSNumber numberWithInteger:-1]; + break; + case WCAccountFieldTypeList: + value = [NSArray array]; + break; + } + } + + [values addObject:value]; + } + + if([values count] == 1) { + value = [values anyObject]; + } + else if([values count] == 0) { + value = NULL; + } + else { + attributes = [NSDictionary dictionaryWithObjectsAndKeys: + [NSColor grayColor], NSForegroundColorAttributeName, + [cell font], NSFontAttributeName, + NULL]; + attributedString = [NSAttributedString attributedStringWithString:NSLS(@"", @"Account field value") + attributes:attributes]; + + if(type == WCAccountFieldTypeBoolean) + value = [NSNumber numberWithInteger:NSMixedState]; + else if(type == WCAccountFieldTypeEnum) { + [cell insertItem:[NSMenuItem itemWithAttributedTitle:attributedString tag:-1] atIndex:0]; + [cell insertItem:[NSMenuItem separatorItem] atIndex:1]; + + value = [NSNumber numberWithInteger:0]; + } + else { + value = [attributedString string]; + } + } + } + + if([name isEqualToString:@"wired.account.transfer.download_speed_limit"] || + [name isEqualToString:@"wired.account.transfer.upload_speed_limit"]) { + if([value isKindOfClass:[NSNumber class]]) + value = [NSNumber numberWithInteger:[value doubleValue] / 1024.0]; + } + + if(type == WCAccountFieldTypeNumber && [value isKindOfClass:[NSNumber class]] && [value integerValue] == 0) + value = NULL; + + return value; + } + + return NULL; } - (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item { - if(tableColumn == _valueTableColumn) - return ([item objectForKey:WCAccountFieldNameKey] != NULL); + if(tableColumn == _valueTableColumn) + return ([item objectForKey:WCAccountFieldNameKey] != NULL); - return NO; + return NO; } - (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { - NSEnumerator *enumerator; - NSString *name; - WCAccount *account; - id cell, value; - WCAccountFieldType type; - - type = [[item objectForKey:WCAccountFieldTypeKey] integerValue]; - name = [item objectForKey:WCAccountFieldNameKey]; - cell = [item objectForKey:WCAccountsFieldCell]; - value = object; - - if(type == WCAccountFieldTypeNumber) { - if([object isKindOfClass:[NSString class]] && [object length] == 0) - return; - - value = [NSNumber numberWithInteger:[value integerValue]]; - } - else if(type == WCAccountFieldTypeBoolean) { - value = [NSNumber numberWithBool:([value integerValue] == -1) ? YES : [value boolValue]]; - } - else if(type == WCAccountFieldTypeEnum) { - if([value integerValue] < 0) - return; - - if([[(NSPopUpButton*)cell itemAtIndex:0] tag] == -1) - value = [NSNumber numberWithInteger:[value integerValue] - 2]; - } - - if([name isEqualToString:@"wired.account.transfer.download_speed_limit"] || - [name isEqualToString:@"wired.account.transfer.upload_speed_limit"]) - value = [NSNumber numberWithInteger:[value integerValue] * 1024.0]; - - enumerator = [_accounts objectEnumerator]; - - while((account = [enumerator nextObject])) - [account setValue:value forKey:name]; - - [self touch:self]; - - [_settingsOutlineView setNeedsDisplay:YES]; + NSEnumerator *enumerator; + NSString *name; + WCAccount *account; + id cell, value; + WCAccountFieldType type; + + type = [[item objectForKey:WCAccountFieldTypeKey] integerValue]; + name = [item objectForKey:WCAccountFieldNameKey]; + cell = [item objectForKey:WCAccountsFieldCell]; + value = object; + + if(type == WCAccountFieldTypeNumber) { + if([object isKindOfClass:[NSString class]] && [object length] == 0) + return; + + value = [NSNumber numberWithInteger:[value integerValue]]; + } + else if(type == WCAccountFieldTypeBoolean) { + value = [NSNumber numberWithBool:([value integerValue] == -1) ? YES : [value boolValue]]; + } + else if(type == WCAccountFieldTypeEnum) { + if([value integerValue] < 0) + return; + + if([[(NSPopUpButton*)cell itemAtIndex:0] tag] == -1) + value = [NSNumber numberWithInteger:[value integerValue] - 2]; + } + + if([name isEqualToString:@"wired.account.transfer.download_speed_limit"] || + [name isEqualToString:@"wired.account.transfer.upload_speed_limit"]) + value = [NSNumber numberWithInteger:[value integerValue] * 1024.0]; + + enumerator = [_accounts objectEnumerator]; + + while((account = [enumerator nextObject])) + [account setValue:value forKey:name]; + + [self touch:self]; + + [_settingsOutlineView setNeedsDisplay:YES]; } - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item { - NSEnumerator *enumerator; - NSString *name; - WCAccount *account; - id value; - WCAccountFieldType type; - BOOL set = NO; - - type = [[item objectForKey:WCAccountFieldTypeKey] integerValue]; - name = [item objectForKey:WCAccountFieldNameKey]; - enumerator = [_accounts objectEnumerator]; - value = [cell objectValue]; - - while((account = [enumerator nextObject])) { - if([account valueForKey:name]) { - set = YES; - - break; - } - } - - if(set) - [cell setFont:[[cell font] fontByAddingTrait:NSBoldFontMask]]; - else - [cell setFont:[[cell font] fontByAddingTrait:NSUnboldFontMask]]; - - - if([cell respondsToSelector:@selector(setTextColor:)]) { - if([value isKindOfClass:value] && [value isEqualToString:NSLS(@"", @"Account field value")]) - [cell setTextColor:[NSColor grayColor]]; - //else - //[cell setTextColor:[NSColor blackColor]]; - } - - if(tableColumn == _valueTableColumn) - [cell setEnabled:[self _canEditAccounts]]; + NSEnumerator *enumerator; + NSString *name; + WCAccount *account; + id value; + WCAccountFieldType type; + BOOL set = NO; + + type = [[item objectForKey:WCAccountFieldTypeKey] integerValue]; + name = [item objectForKey:WCAccountFieldNameKey]; + enumerator = [_accounts objectEnumerator]; + value = [cell objectValue]; + + while((account = [enumerator nextObject])) { + if([account valueForKey:name]) { + set = YES; + + break; + } + } + + if(set) + [cell setFont:[[cell font] fontByAddingTrait:NSBoldFontMask]]; + else + [cell setFont:[[cell font] fontByAddingTrait:NSUnboldFontMask]]; + + + if([cell respondsToSelector:@selector(setTextColor:)]) { + if([value isKindOfClass:value] && [value isEqualToString:NSLS(@"", @"Account field value")]) + [cell setTextColor:[NSColor grayColor]]; + //else + //[cell setTextColor:[NSColor blackColor]]; + } + + if(tableColumn == _valueTableColumn) + [cell setEnabled:[self _canEditAccounts]]; } - (NSString *)outlineView:(NSOutlineView *)outlineView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tableColumn item:(id)item mouseLocation:(NSPoint)mouseLocation { - return [item objectForKey:WCAccountFieldToolTipKey]; + return [item objectForKey:WCAccountFieldToolTipKey]; } - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { - return ([[item objectForKey:WCAccountsFieldSettings] count] > 0); + return ([[item objectForKey:WCAccountsFieldSettings] count] > 0); } @end @@ -2325,14 +2356,14 @@ - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { @implementation WCAccountsTableColumn - (id)dataCellForRow:(NSInteger)row { - id cell; - - cell = [[(NSOutlineView *) [self tableView] itemAtRow:row] objectForKey:WCAccountsFieldCell]; - - if(cell) - return cell; - - return [super dataCellForRow:row]; + id cell; + + cell = [[(NSOutlineView *) [self tableView] itemAtRow:row] objectForKey:WCAccountsFieldCell]; + + if(cell) + return cell; + + return [super dataCellForRow:row]; } @end diff --git a/Sources/WCAdministration.m b/Sources/WCAdministration.m index fd03cfea..796a62f1 100644 --- a/Sources/WCAdministration.m +++ b/Sources/WCAdministration.m @@ -30,11 +30,11 @@ #import "WCErrorQueue.h" #import "WCServerConnection.h" -#define WCAdministrationIdentifierKey @"WCAdministrationIdentifierKey" -#define WCAdministrationViewKey @"WCAdministrationViewKey" -#define WCAdministrationNameKey @"WCAdministrationNameKey" -#define WCAdministrationImageKey @"WCAdministrationImageKey" -#define WCAdministrationControllerKey @"WCAdministrationControllerKey" +#define WCAdministrationIdentifierKey @"WCAdministrationIdentifierKey" +#define WCAdministrationViewKey @"WCAdministrationViewKey" +#define WCAdministrationNameKey @"WCAdministrationNameKey" +#define WCAdministrationImageKey @"WCAdministrationImageKey" +#define WCAdministrationControllerKey @"WCAdministrationControllerKey" @interface WCAdministration(Private) @@ -52,17 +52,22 @@ - (NSString *)_identifierForController:(id)controller; @implementation WCAdministration(Private) - (id)_initAdministrationWithConnection:(WCServerConnection *)connection { - self = [super initWithWindowNibName:@"Administration" - name:NSLS(@"Administration", @"Administration window title") - connection:connection - singleton:YES]; - - _identifiers = [[NSMutableArray alloc] init]; - _views = [[NSMutableDictionary alloc] init]; + self = [super initWithWindowNibName:@"Administration" + name:NSLS(@"Administration", @"Administration window title") + connection:connection + singleton:YES]; + + _identifiers = [[NSMutableArray alloc] init]; + _views = [[NSMutableDictionary alloc] init]; - [self window]; - - return self; + [self window]; + + [[NSDistributedNotificationCenter defaultCenter] addObserver:self + selector:@selector(appleInterfaceThemeChanged:) + name:@"AppleInterfaceThemeChangedNotification" + object: nil]; + + return self; } @@ -70,112 +75,112 @@ - (id)_initAdministrationWithConnection:(WCServerConnection *)connection { #pragma mark - - (void)_addAdministrationView:(NSView *)view name:(NSString *)name image:(NSImage *)image identifier:(NSString *)identifier controller:(id)controller { - NSMutableDictionary *dictionary; - - [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable | NSViewMaxXMargin | NSViewMaxYMargin]; - - dictionary = [NSMutableDictionary dictionary]; - [dictionary setObject:identifier forKey:WCAdministrationIdentifierKey]; - [dictionary setObject:view forKey:WCAdministrationViewKey]; - [dictionary setObject:name forKey:WCAdministrationNameKey]; - [dictionary setObject:image forKey:WCAdministrationImageKey]; - [dictionary setObject:controller forKey:WCAdministrationControllerKey]; - - [_identifiers addObject:identifier]; - [_views setObject:dictionary forKey:identifier]; + NSMutableDictionary *dictionary; + + [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable | NSViewMaxXMargin | NSViewMaxYMargin]; + + dictionary = [NSMutableDictionary dictionary]; + [dictionary setObject:identifier forKey:WCAdministrationIdentifierKey]; + [dictionary setObject:view forKey:WCAdministrationViewKey]; + [dictionary setObject:name forKey:WCAdministrationNameKey]; + [dictionary setObject:image forKey:WCAdministrationImageKey]; + [dictionary setObject:controller forKey:WCAdministrationControllerKey]; + + [_identifiers addObject:identifier]; + [_views setObject:dictionary forKey:identifier]; } - (void)_selectAdministrationViewWithIdentifier:(NSString *)identifier animate:(BOOL)animate { - NSViewAnimation *animation; - NSDictionary *dictionary; - NSArray *animations; - NSView *view; - id controller; - NSRect frame; - NSSize size; - - dictionary = [_views objectForKey:identifier]; - view = [dictionary objectForKey:WCAdministrationViewKey]; - controller = [dictionary objectForKey:WCAdministrationControllerKey]; - - if(view != _shownView) { - [_shownController controllerDidUnselect]; - [_shownView removeFromSuperview]; - - [view setHidden:YES]; - - frame = [[self window] frame]; - frame.size = [[self window] frameRectForContentRect:[view frame]].size; - - size = [controller maximumWindowSize]; - - if(!NSEqualSizes(size, NSZeroSize)) { - if(frame.size.width > size.width) - frame.size.width = size.width; - - if(frame.size.height > size.height) - frame.size.height = size.height; - } - - size = [controller minimumWindowSize]; - - if(!NSEqualSizes(size, NSZeroSize)) { - if(frame.size.width < size.width) - frame.size.width = size.width; - - if(frame.size.height < size.height) - frame.size.height = size.height; - } - - frame.origin.y -= frame.size.height - [[self window] frame].size.height; - [[self window] setFrame:frame display:YES animate:animate]; - - [[[self window] contentView] addSubview:view]; - - if(animate) { - animations = [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys: - view, - NSViewAnimationTargetKey, - NSViewAnimationFadeInEffect, - NSViewAnimationEffectKey, - NULL]]; - - animation = [[NSViewAnimation alloc] initWithViewAnimations:animations]; - [animation setAnimationBlockingMode:NSAnimationNonblocking]; - [animation setDuration:0.25]; - [animation startAnimation]; - [animation release]; - } else { - [view setHidden:NO]; - } - - [[[self window] toolbar] setSelectedItemIdentifier:identifier]; - - _shownView = view; - _shownController = controller; - - [[self window] setTitle:[[self connection] name] withSubtitle:[self name]]; - - [controller controllerDidSelect]; - } + NSViewAnimation *animation; + NSDictionary *dictionary; + NSArray *animations; + NSView *view; + id controller; + NSRect frame; + NSSize size; + + dictionary = [_views objectForKey:identifier]; + view = [dictionary objectForKey:WCAdministrationViewKey]; + controller = [dictionary objectForKey:WCAdministrationControllerKey]; + + if(view != _shownView) { + [_shownController controllerDidUnselect]; + [_shownView removeFromSuperview]; + + [view setHidden:YES]; + + frame = [[self window] frame]; + frame.size = [[self window] frameRectForContentRect:[view frame]].size; + + size = [controller maximumWindowSize]; + + if(!NSEqualSizes(size, NSZeroSize)) { + if(frame.size.width > size.width) + frame.size.width = size.width; + + if(frame.size.height > size.height) + frame.size.height = size.height; + } + + size = [controller minimumWindowSize]; + + if(!NSEqualSizes(size, NSZeroSize)) { + if(frame.size.width < size.width) + frame.size.width = size.width; + + if(frame.size.height < size.height) + frame.size.height = size.height; + } + + frame.origin.y -= frame.size.height - [[self window] frame].size.height; + [[self window] setFrame:frame display:YES animate:animate]; + + [[[self window] contentView] addSubview:view]; + + if(animate) { + animations = [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys: + view, + NSViewAnimationTargetKey, + NSViewAnimationFadeInEffect, + NSViewAnimationEffectKey, + NULL]]; + + animation = [[NSViewAnimation alloc] initWithViewAnimations:animations]; + [animation setAnimationBlockingMode:NSAnimationNonblocking]; + [animation setDuration:0.25]; + [animation startAnimation]; + [animation release]; + } else { + [view setHidden:NO]; + } + + [[[self window] toolbar] setSelectedItemIdentifier:identifier]; + + _shownView = view; + _shownController = controller; + + [[self window] setTitle:[[self connection] name] withSubtitle:[self name]]; + + [controller controllerDidSelect]; + } } - (NSString *)_identifierForController:(id)controller { - NSEnumerator *enumerator; - NSString *identifier; - - enumerator = [_views keyEnumerator]; - - while((identifier = [enumerator nextObject])) { - if([[_views objectForKey:identifier] objectForKey:WCAdministrationControllerKey] == controller) - return identifier; - } - - return NULL; + NSEnumerator *enumerator; + NSString *identifier; + + enumerator = [_views keyEnumerator]; + + while((identifier = [enumerator nextObject])) { + if([[_views objectForKey:identifier] objectForKey:WCAdministrationControllerKey] == controller) + return identifier; + } + + return NULL; } @end @@ -185,23 +190,23 @@ - (NSString *)_identifierForController:(id)controller { @implementation WCAdministration + (id)administrationWithConnection:(WCServerConnection *)connection { - return [[[self alloc] _initAdministrationWithConnection:connection] autorelease]; + return [[[self alloc] _initAdministrationWithConnection:connection] autorelease]; } - (void)dealloc { - [_monitorController setAdministration:NULL]; - [_logController setAdministration:NULL]; - [_settingsController setAdministration:NULL]; - [_banlistController setAdministration:NULL]; - - [_errorQueue release]; - - [_identifiers release]; - [_views release]; + [_monitorController setAdministration:NULL]; + [_logController setAdministration:NULL]; + [_settingsController setAdministration:NULL]; + [_banlistController setAdministration:NULL]; + + [_errorQueue release]; + + [_identifiers release]; + [_views release]; - [super dealloc]; + [super dealloc]; } @@ -209,251 +214,269 @@ - (void)dealloc { #pragma mark - - (void)themeDidChange:(NSDictionary *)theme { - NSEnumerator *enumerator; - NSDictionary *dictionary; - - enumerator = [_views objectEnumerator]; - - while((dictionary = [enumerator nextObject])) - [[dictionary objectForKey:WCAdministrationControllerKey] themeDidChange:theme]; + NSEnumerator *enumerator; + NSDictionary *dictionary; + + enumerator = [_views objectEnumerator]; + + while((dictionary = [enumerator nextObject])) + [[dictionary objectForKey:WCAdministrationControllerKey] themeDidChange:theme]; } - (void)windowDidLoad { - NSEnumerator *enumerator; - NSWindow *window; - NSToolbar *toolbar; - NSDictionary *dictionary; - NSString *key, *string; - - [self _addAdministrationView:_settingsView - name:NSLS(@"Settings", @"Settings toolbar item") - image:[NSImage imageNamed:@"Settings"] - identifier:@"Settings" - controller:_settingsController]; - - [self _addAdministrationView:_monitorView - name:NSLS(@"Monitor", @"Monitor toolbar item") - image:[NSImage imageNamed:@"Monitor"] - identifier:@"Monitor" - controller:_monitorController]; - - [self _addAdministrationView:_eventsView - name:NSLS(@"Events", @"Events toolbar item") - image:[NSImage imageNamed:@"Events"] - identifier:@"Events" - controller:_eventsController]; - - [self _addAdministrationView:_logView - name:NSLS(@"Log", @"Log toolbar item") - image:[NSImage imageNamed:@"Log"] - identifier:@"Log" - controller:_logController]; - - [self _addAdministrationView:_accountsView - name:NSLS(@"Accounts", @"Accounts toolbar item") - image:[NSImage imageNamed:@"Accounts"] - identifier:@"Accounts" - controller:_accountsController]; - - [self _addAdministrationView:_banlistView - name:NSLS(@"Banlist", @"Banlist toolbar item") - image:[NSImage imageNamed:@"Banlist"] - identifier:@"Banlist" - controller:_banlistController]; - - window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0.0, 0.0, 100.0, 100.0) - styleMask:NSTitledWindowMask | - NSClosableWindowMask | - NSMiniaturizableWindowMask | - NSResizableWindowMask - backing:NSBackingStoreBuffered - defer:YES]; - [window setDelegate:self]; - [self setWindow:window]; - [window release]; - - _errorQueue = [[WCErrorQueue alloc] initWithWindow:[self window]]; - - toolbar = [[NSToolbar alloc] initWithIdentifier:@"Administration"]; - [toolbar setDelegate:self]; - [toolbar setAllowsUserCustomization:YES]; - [toolbar setAutosavesConfiguration:YES]; - [[self window] setToolbar:toolbar]; - [toolbar release]; - - [[self window] center]; - - [self setShouldCascadeWindows:NO]; - [self setShouldSaveWindowFrameOriginOnly:YES]; - [self setWindowFrameAutosaveName:@"Administration"]; - - enumerator = [_views objectEnumerator]; - - while((dictionary = [enumerator nextObject])) { - key = [NSSWF:@"%@ %@ Frame", [self class], [dictionary objectForKey:WCAdministrationIdentifierKey]]; - string = [[WCSettings settings] objectForKey:key]; - - if(string) - [[dictionary objectForKey:WCAdministrationViewKey] setFrame:NSRectFromString(string)]; - - [[dictionary objectForKey:WCAdministrationControllerKey] windowDidLoad]; - } - - [self _selectAdministrationViewWithIdentifier:[_identifiers objectAtIndex:0] animate:NO]; - - [super windowDidLoad]; + NSEnumerator *enumerator; + NSWindow *window; + NSToolbar *toolbar; + NSDictionary *dictionary; + NSString *key, *string; + + [self _addAdministrationView:_settingsView + name:NSLS(@"Settings", @"Settings toolbar item") + image:[NSImage imageNamed:@"Settings"] + identifier:@"Settings" + controller:_settingsController]; + + [self _addAdministrationView:_monitorView + name:NSLS(@"Monitor", @"Monitor toolbar item") + image:[NSImage imageNamed:@"Monitor"] + identifier:@"Monitor" + controller:_monitorController]; + + [self _addAdministrationView:_eventsView + name:NSLS(@"Events", @"Events toolbar item") + image:[NSImage imageNamed:@"Events"] + identifier:@"Events" + controller:_eventsController]; + + [self _addAdministrationView:_logView + name:NSLS(@"Log", @"Log toolbar item") + image:[NSImage imageNamed:@"Log"] + identifier:@"Log" + controller:_logController]; + + [self _addAdministrationView:_accountsView + name:NSLS(@"Accounts", @"Accounts toolbar item") + image:[NSImage imageNamed:@"Accounts"] + identifier:@"Accounts" + controller:_accountsController]; + + + [self _addAdministrationView:_banlistView + name:NSLS(@"Banlist", @"Banlist toolbar item") + image:[NSImage imageNamed:@"Banlist"] + identifier:@"Banlist" + controller:_banlistController]; + + window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0.0, 0.0, 100.0, 100.0) + styleMask:NSTitledWindowMask | + NSClosableWindowMask | + NSMiniaturizableWindowMask | + NSResizableWindowMask + backing:NSBackingStoreBuffered + defer:YES]; + [window setDelegate:self]; + [self setWindow:window]; + [window release]; + + _errorQueue = [[WCErrorQueue alloc] initWithWindow:[self window]]; + + toolbar = [[NSToolbar alloc] initWithIdentifier:@"Administration"]; + [toolbar setDelegate:self]; + [toolbar setAllowsUserCustomization:YES]; + [toolbar setAutosavesConfiguration:YES]; + [[self window] setToolbar:toolbar]; + [toolbar release]; + + [[self window] center]; + + [self setShouldCascadeWindows:NO]; + [self setShouldSaveWindowFrameOriginOnly:YES]; + [self setWindowFrameAutosaveName:@"Administration"]; + + enumerator = [_views objectEnumerator]; + + while((dictionary = [enumerator nextObject])) { + key = [NSSWF:@"%@ %@ Frame", [self class], [dictionary objectForKey:WCAdministrationIdentifierKey]]; + string = [[WCSettings settings] objectForKey:key]; + + if(string) + [[dictionary objectForKey:WCAdministrationViewKey] setFrame:NSRectFromString(string)]; + + [[dictionary objectForKey:WCAdministrationControllerKey] windowDidLoad]; + } + + [self _selectAdministrationViewWithIdentifier:[_identifiers objectAtIndex:0] animate:NO]; + + [super windowDidLoad]; } - (void)windowDidBecomeKey:(NSNotification *)notification { - [_shownController controllerWindowDidBecomeKey]; + [_shownController controllerWindowDidBecomeKey]; } - (BOOL)windowShouldClose:(id)window { - return [_shownController controllerWindowShouldClose]; + return [_shownController controllerWindowShouldClose]; } - (void)windowWillClose:(NSNotification *)notification { - NSEnumerator *enumerator; - NSDictionary *dictionary; - NSView *view; - NSString *key; - - enumerator = [_views objectEnumerator]; - - while((dictionary = [enumerator nextObject])) { - key = [NSSWF:@"%@ %@ Frame", [self class], [dictionary objectForKey:WCAdministrationIdentifierKey]]; - view = [dictionary objectForKey:WCAdministrationViewKey]; - - [[WCSettings settings] setObject:NSStringFromRect([view frame]) forKey:key]; - } - - [_shownController controllerWindowWillClose]; + NSEnumerator *enumerator; + NSDictionary *dictionary; + NSView *view; + NSString *key; + + enumerator = [_views objectEnumerator]; + + while((dictionary = [enumerator nextObject])) { + key = [NSSWF:@"%@ %@ Frame", [self class], [dictionary objectForKey:WCAdministrationIdentifierKey]]; + view = [dictionary objectForKey:WCAdministrationViewKey]; + + [[WCSettings settings] setObject:NSStringFromRect([view frame]) forKey:key]; + } + + [_shownController controllerWindowWillClose]; } - (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedSize { - NSSize size; - - size = [_shownController maximumWindowSize]; - - if(!NSEqualSizes(size, NSZeroSize)) { - if(proposedSize.width > size.width) - proposedSize.width = size.width; - - if(proposedSize.height > size.height) - proposedSize.height = size.height; - } - - size = [_shownController minimumWindowSize]; - - if(!NSEqualSizes(size, NSZeroSize)) { - if(proposedSize.width < size.width) - proposedSize.width = size.width; - - if(proposedSize.height < size.height) - proposedSize.height = size.height; - } - - return proposedSize; + NSSize size; + + size = [_shownController maximumWindowSize]; + + if(!NSEqualSizes(size, NSZeroSize)) { + if(proposedSize.width > size.width) + proposedSize.width = size.width; + + if(proposedSize.height > size.height) + proposedSize.height = size.height; + } + + size = [_shownController minimumWindowSize]; + + if(!NSEqualSizes(size, NSZeroSize)) { + if(proposedSize.width < size.width) + proposedSize.width = size.width; + + if(proposedSize.height < size.height) + proposedSize.height = size.height; + } + + return proposedSize; } - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)identifier willBeInsertedIntoToolbar:(BOOL)willBeInsertedIntoToolbar { - NSDictionary *dictionary; - - dictionary = [_views objectForKey:identifier]; - - return [NSToolbarItem toolbarItemWithIdentifier:identifier - name:[dictionary objectForKey:WCAdministrationNameKey] - content:[dictionary objectForKey:WCAdministrationImageKey] - target:self - action:@selector(toolbarItem:)]; + NSDictionary *dictionary; + + dictionary = [_views objectForKey:identifier]; + + return [NSToolbarItem toolbarItemWithIdentifier:identifier + name:[dictionary objectForKey:WCAdministrationNameKey] + content:[dictionary objectForKey:WCAdministrationImageKey] + target:self + action:@selector(toolbarItem:)]; } - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar { - return _identifiers; + return _identifiers; } - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar { - return [self toolbarDefaultItemIdentifiers:toolbar]; + return [self toolbarDefaultItemIdentifiers:toolbar]; } - (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar { - return [self toolbarDefaultItemIdentifiers:toolbar]; + return [self toolbarDefaultItemIdentifiers:toolbar]; } - (void)linkConnectionLoggedIn:(NSNotification *)notification { - NSEnumerator *enumerator; - NSDictionary *dictionary; - - enumerator = [_views objectEnumerator]; - - while((dictionary = [enumerator nextObject])) - [[dictionary objectForKey:WCAdministrationControllerKey] linkConnectionLoggedIn:notification]; - - [super linkConnectionLoggedIn:notification]; + NSEnumerator *enumerator; + NSDictionary *dictionary; + + enumerator = [_views objectEnumerator]; + + while((dictionary = [enumerator nextObject])) + [[dictionary objectForKey:WCAdministrationControllerKey] linkConnectionLoggedIn:notification]; + + [super linkConnectionLoggedIn:notification]; } - (void)linkConnectionDidClose:(NSNotification *)notification { - NSEnumerator *enumerator; - NSDictionary *dictionary; - - enumerator = [_views objectEnumerator]; - - while((dictionary = [enumerator nextObject])) - [[dictionary objectForKey:WCAdministrationControllerKey] linkConnectionDidClose:notification]; + NSEnumerator *enumerator; + NSDictionary *dictionary; + + enumerator = [_views objectEnumerator]; + + while((dictionary = [enumerator nextObject])) + [[dictionary objectForKey:WCAdministrationControllerKey] linkConnectionDidClose:notification]; - [super linkConnectionDidClose:notification]; + [super linkConnectionDidClose:notification]; } - (void)serverConnectionPrivilegesDidChange:(NSNotification *)notification { - NSEnumerator *enumerator; - NSDictionary *dictionary; - - enumerator = [_views objectEnumerator]; - - while((dictionary = [enumerator nextObject])) - [[dictionary objectForKey:WCAdministrationControllerKey] serverConnectionPrivilegesDidChange:notification]; + NSEnumerator *enumerator; + NSDictionary *dictionary; + + enumerator = [_views objectEnumerator]; + + while((dictionary = [enumerator nextObject])) + [[dictionary objectForKey:WCAdministrationControllerKey] serverConnectionPrivilegesDidChange:notification]; - [super serverConnectionPrivilegesDidChange:notification]; + [super serverConnectionPrivilegesDidChange:notification]; } + +#pragma mark - + +- (void)appleInterfaceThemeChanged:(NSNotification *)notification { + NSToolbarItem *item; + NSString *imageName; + + item = [[[self window] toolbar] itemWithIdentifier:@"Accounts"]; + imageName = [NSApp darkModeEnabled] ? @"Accounts" : @"Accounts"; + + item.image = [NSImage imageNamed:imageName]; +} + + + + + #pragma mark - - (void)validate { - [[[self window] toolbar] validateVisibleItems]; + [[[self window] toolbar] validateVisibleItems]; - [super validate]; + [super validate]; } - (BOOL)validateMenuItem:(NSMenuItem *)item { - return [[self selectedController] validateMenuItem:item]; + return [[self selectedController] validateMenuItem:item]; } @@ -461,13 +484,13 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item { #pragma mark - - (NSString *)newDocumentMenuItemTitle { - return [[self selectedController] newDocumentMenuItemTitle]; + return [[self selectedController] newDocumentMenuItemTitle]; } - (NSString *)deleteDocumentMenuItemTitle { - return [[self selectedController] deleteDocumentMenuItemTitle]; + return [[self selectedController] deleteDocumentMenuItemTitle]; } @@ -475,23 +498,23 @@ - (NSString *)deleteDocumentMenuItemTitle { #pragma mark - - (void)selectController:(id)controller { - NSString *identifier; - - if([_shownController controllerShouldUnselectForNewController:controller]) { - identifier = [self _identifierForController:controller]; - - [self _selectAdministrationViewWithIdentifier:identifier animate:YES]; - } else { - identifier = [self _identifierForController:_shownController]; + NSString *identifier; + + if([_shownController controllerShouldUnselectForNewController:controller]) { + identifier = [self _identifierForController:controller]; + + [self _selectAdministrationViewWithIdentifier:identifier animate:YES]; + } else { + identifier = [self _identifierForController:_shownController]; - [[[self window] toolbar] setSelectedItemIdentifier:identifier]; - } + [[[self window] toolbar] setSelectedItemIdentifier:identifier]; + } } - (id)selectedController { - return _shownController; + return _shownController; } @@ -499,37 +522,37 @@ - (id)selectedController { #pragma mark - - (WCSettingsController *)settingsController { - return _settingsController; + return _settingsController; } - (WCMonitorController *)monitorController { - return _monitorController; + return _monitorController; } - (WCEventsController *)eventsController { - return _eventsController; + return _eventsController; } - (WCLogController *)logController { - return _logController; + return _logController; } - (WCAccountsController *)accountsController { - return _accountsController; + return _accountsController; } - (WCBanlistController *)banlistController { - return _banlistController; + return _banlistController; } @@ -537,7 +560,7 @@ - (WCBanlistController *)banlistController { #pragma mark - - (void)showError:(WCError *)error { - [_errorQueue showError:error]; + [_errorQueue showError:error]; } @@ -545,47 +568,47 @@ - (void)showError:(WCError *)error { #pragma mark - - (NSString *)name { - NSString *identifier; - - identifier = [self _identifierForController:_shownController]; - - return [[_views objectForKey:identifier] objectForKey:WCAdministrationNameKey]; + NSString *identifier; + + identifier = [self _identifierForController:_shownController]; + + return [[_views objectForKey:identifier] objectForKey:WCAdministrationNameKey]; } #pragma mark - - (IBAction)newDocument:(id)sender { - [[self selectedController] newDocument:self]; + [[self selectedController] newDocument:self]; } - (IBAction)deleteDocument:(id)sender { - [[self selectedController] deleteDocument:self]; + [[self selectedController] deleteDocument:self]; } - (IBAction)toolbarItem:(id)sender { - NSString *identifier; - id controller; - - controller = [[_views objectForKey:[sender itemIdentifier]] objectForKey:WCAdministrationControllerKey]; - - if([_shownController controllerShouldUnselectForNewController:controller]) { - [self _selectAdministrationViewWithIdentifier:[sender itemIdentifier] animate:YES]; - } else { - identifier = [self _identifierForController:_shownController]; + NSString *identifier; + id controller; + + controller = [[_views objectForKey:[sender itemIdentifier]] objectForKey:WCAdministrationControllerKey]; + + if([_shownController controllerShouldUnselectForNewController:controller]) { + [self _selectAdministrationViewWithIdentifier:[sender itemIdentifier] animate:YES]; + } else { + identifier = [self _identifierForController:_shownController]; - [[[self window] toolbar] setSelectedItemIdentifier:identifier]; - } + [[[self window] toolbar] setSelectedItemIdentifier:identifier]; + } } - (IBAction)submitSheet:(id)sender { - [_shownController submitSheet:sender]; + [_shownController submitSheet:sender]; } @end @@ -632,7 +655,7 @@ - (void)controllerWindowWillClose { - (BOOL)controllerWindowShouldClose { - return YES; + return YES; } @@ -643,7 +666,7 @@ - (void)controllerDidSelect { - (BOOL)controllerShouldUnselectForNewController:(id)controller { - return YES; + return YES; } @@ -652,11 +675,10 @@ - (void)controllerDidUnselect { } - #pragma mark - - (BOOL)validateMenuItem:(NSMenuItem *)item { - return YES; + return YES; } @@ -664,13 +686,13 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item { #pragma mark - - (NSSize)maximumWindowSize { - return NSZeroSize; + return NSZeroSize; } - (NSSize)minimumWindowSize { - return NSZeroSize; + return NSZeroSize; } @@ -678,13 +700,13 @@ - (NSSize)minimumWindowSize { #pragma mark - - (NSString *)newDocumentMenuItemTitle { - return NULL; + return NULL; } - (NSString *)deleteDocumentMenuItemTitle { - return NULL; + return NULL; } @@ -704,7 +726,7 @@ - (IBAction)deleteDocument:(id)sender { #pragma mark - - (void)setAdministration:(WCAdministration *)administration { - _administration = administration; + _administration = administration; } @end diff --git a/Sources/WCChatController.m b/Sources/WCChatController.m index dffb2e21..28302c88 100644 --- a/Sources/WCChatController.m +++ b/Sources/WCChatController.m @@ -2615,7 +2615,7 @@ - (NSView *)tableView:(NSTableView *)tableView //if(row != [tableView selectedRow]) cellView.nickTextField.textColor = [WCUser colorForColor:[user color] idleTint:[user isIdle]]; //else - // cellView.nickTextField.textColor = [NSColor whiteColor]; + // cellView.nickTextField.textColor = [NSColor whiteColor]; [cellView.nickTextField setAllowsEditingTextAttributes:YES]; @@ -2639,11 +2639,12 @@ - (NSView *)tableView:(NSTableView *)tableView cellView.statusTextField.toolTip = [user status]; cellView.statusTextField.stringValue = [user status]; + NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"]; if (osxMode == nil) { cellView.statusTextField.textColor = [NSColor colorWithCalibratedRed:153.0/255.0 green:153.0/255.0 blue:153.0/255.0 alpha:1.0]; //Light mode } else { - cellView.statusTextField.textColor = [NSColor colorWithCalibratedRed:197.0/255.0 green:197.0/255.0 blue:197.0/255.0 alpha:1.0]; //Dark mode + cellView.statusTextField.textColor = [NSColor colorWithCalibratedRed:130.0/255.0 green:130.0/255.0 blue:130.0/255.0 alpha:0.7 ] ; //Dark mode } cellView.imageView.image = [user iconWithIdleTint:YES]; diff --git a/Sources/WCPublicChat.m b/Sources/WCPublicChat.m index fa2aed5a..324287ce 100644 --- a/Sources/WCPublicChat.m +++ b/Sources/WCPublicChat.m @@ -122,6 +122,7 @@ - (void)_updateToolbarForConnection:(WCServerConnection *)connection { item = [[[self window] toolbar] itemWithIdentifier:@"Transfers"]; [item setImage:[[NSImage imageNamed:@"Transfers"] badgedImageWithInt:[[WCTransfers transfers] numberOfUncompleteTransfers]]]; + } @@ -623,7 +624,7 @@ - (void)windowWillClose:(NSNotification *)notification { - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)identifier willBeInsertedIntoToolbar:(BOOL)willBeInsertedIntoToolbar { NSButton *button; - + if([identifier isEqualToString:@"Banner"]) { button = [[[NSButton alloc] initWithFrame:NSMakeRect(0.0, 0.0, 200.0, 32.0)] autorelease]; [button setBordered:NO]; @@ -715,12 +716,12 @@ - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString action:@selector(chatHistory:)]; } else if([identifier isEqualToString:@"Accounts"]) { - return [NSToolbarItem toolbarItemWithIdentifier:identifier + return [NSToolbarItem toolbarItemWithIdentifier:identifier name:NSLS(@"Accounts", @"Accounts toolbar item") content:[NSImage imageNamed:@"Accounts"] target:self action:@selector(accounts:)]; - } + } else if([identifier isEqualToString:@"Banlist"]) { return [NSToolbarItem toolbarItemWithIdentifier:identifier name:NSLS(@"Banlist", @"Banlist toolbar item") diff --git a/WiredClient.xcodeproj/project.pbxproj b/WiredClient.xcodeproj/project.pbxproj index 5e591869..01bea239 100644 --- a/WiredClient.xcodeproj/project.pbxproj +++ b/WiredClient.xcodeproj/project.pbxproj @@ -1500,7 +1500,6 @@ 4CF094B21559D529005D77BB /* Copy Templates */, 770B8A64075C86BD005327F5 /* Copy Frameworks */, 41A4977D16E8C8CEE4C029C0 /* [CP] Embed Pods Frameworks */, - 4CE1792E244078A0004EFD52 /* Code Sign */, ); buildRules = ( ); @@ -1526,8 +1525,8 @@ LastUpgradeCheck = 1010; TargetAttributes = { 8D1107260486CEB800E47090 = { - DevelopmentTeam = 7KTXA5Y36K; - ProvisioningStyle = Manual; + DevelopmentTeam = 4ATFWV7M4B; + ProvisioningStyle = Automatic; }; }; }; @@ -1747,24 +1746,6 @@ shellPath = /bin/bash; shellScript = "sh \"$SRCROOT/../wired_client_distribute.sh\" >> \"$BUILT_PRODUCTS_DIR/wired_client_distribute.log\"\n"; }; - 4CE1792E244078A0004EFD52 /* Code Sign */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Code Sign"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Type a script or drag a script file from your workspace to insert its path.\ncodesign --force --sign \"Developer ID Application: Rafael Warnault (7KTXA5Y36K)\" \"$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app\"\n"; - }; 4D5C19408B81356B3BB3BE34 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -2335,17 +2316,17 @@ }; 4C9C2553243F78F4005F214C /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 52A30D560B7D36A2AD0F2511 /* Pods-Wired Client.debug.xcconfig */; + baseConfigurationReference = 8412F05D439B9F0793485926 /* Pods-Wired Client.release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_ENTITLEMENTS = "Wired Client.entitlements"; - CODE_SIGN_IDENTITY = "Developer ID Application"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 53; - DEVELOPMENT_TEAM = 7KTXA5Y36K; + CURRENT_PROJECT_VERSION = 55; + DEVELOPMENT_TEAM = 4ATFWV7M4B; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -2371,7 +2352,7 @@ "$(inherited)", "$(PROJECT_DIR)/vendor/WiredFrameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; MARKETING_VERSION = 2.5; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = "fr.read-write.WiredClient"; @@ -2595,11 +2576,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_ENTITLEMENTS = "Wired Client.entitlements"; - CODE_SIGN_IDENTITY = "Developer ID Application"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 53; - DEVELOPMENT_TEAM = 7KTXA5Y36K; + CURRENT_PROJECT_VERSION = 55; + DEVELOPMENT_TEAM = 4ATFWV7M4B; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -2625,7 +2606,7 @@ "$(inherited)", "$(PROJECT_DIR)/vendor/WiredFrameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; MARKETING_VERSION = 2.5; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = "fr.read-write.WiredClientDebug"; @@ -2700,14 +2681,14 @@ ALWAYS_SEARCH_USER_PATHS = NO; CODE_SIGN_ENTITLEMENTS = "Wired Client.entitlements"; CODE_SIGN_IDENTITY = "-"; - CURRENT_PROJECT_VERSION = 53; + CURRENT_PROJECT_VERSION = 55; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Pods/Sparkle", ); LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; MARKETING_VERSION = 2.5; PRODUCT_NAME = "Wired Client"; USER_HEADER_SEARCH_PATHS = "\"$(BUILT_PRODUCTS_DIR)\"/**"; diff --git a/de.lproj/Localizable.strings b/de.lproj/Localizable.strings index 645c66e6..3a80fd8f 100755 Binary files a/de.lproj/Localizable.strings and b/de.lproj/Localizable.strings differ diff --git a/en.lproj/Localizable.strings b/en.lproj/Localizable.strings index ba89f006..c4641b73 100644 Binary files a/en.lproj/Localizable.strings and b/en.lproj/Localizable.strings differ diff --git a/en.lproj/PublicChat.xib b/en.lproj/PublicChat.xib index ab0bf9a1..a100e9f1 100755 --- a/en.lproj/PublicChat.xib +++ b/en.lproj/PublicChat.xib @@ -1,9 +1,9 @@ - + - - + + @@ -77,7 +77,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -137,20 +137,19 @@ - + - + - @@ -165,7 +164,7 @@ - + @@ -179,7 +178,7 @@ - + @@ -200,7 +199,7 @@ - + @@ -225,7 +224,7 @@ - + @@ -250,7 +249,7 @@ - + @@ -259,7 +258,7 @@ - + @@ -302,7 +301,7 @@ - +