Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Auctions
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Wilcox Technologies
Auctions
Commits
d076b4c7
Commit
d076b4c7
authored
Jun 20, 2012
by
A. Wilcox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XUI: No more X-specific account cruft for Tree controller to use.
parent
0f2eaf88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
13 deletions
+57
-13
Frontends/AuctionsX/AuctionsX/AuXAccountTreeController.mm
Frontends/AuctionsX/AuctionsX/AuXAccountTreeController.mm
+57
-13
No files found.
Frontends/AuctionsX/AuctionsX/AuXAccountTreeController.mm
View file @
d076b4c7
...
...
@@ -7,15 +7,45 @@
//
#import "AuXAccountTreeController.h"
#import "AuXAccount.h"
#import "AuXAccountManager.h"
#import <Cocoa/Cocoa.h>
#include <Managers/AuAccountManager.h>
@implementation
AuXAccountTreeController
@synthesize
dashboard
;
-
(
AuAccount
)
accountForItem
:(
id
)
item
{
AuAccount
account
=
AuAccountManager
::
accounts
().
at
([
item
intValue
]);
return
account
;
}
/*!
@brief Determines if the item is editable.
@result YES if this item is an account (and editable); NO otherwise.
*/
-
(
BOOL
)
outlineView
:(
NSOutlineView
*
)
outlineView
shouldEditTableColumn
:(
NSTableColumn
*
)
tableColumn
item
:(
id
)
item
{
if
([
item
isKindOfClass
:[
NSValue
class
]])
return
YES
;
else
return
NO
;
}
-
(
void
)
outlineView
:(
NSOutlineView
*
)
outlineView
setObjectValue
:(
id
)
object
forTableColumn
:(
NSTableColumn
*
)
tableColumn
byItem
:(
id
)
item
{
NSAssert
(([
item
isKindOfClass
:[
NSNumber
class
]]),
@"editing item must be an account"
);
AuAccount
account
=
[
self
accountForItem
:
item
];
AuAccountManager
::
changeFriendly
(
account
.
site
,
[
object
UTF8String
]);
[
outlineView
reloadItem
:
item
reloadChildren
:
NO
];
}
/*!
@brief Determines if the item is a "group" item, or a main heading.
@result YES if this item is a group item; NO otherwise.
...
...
@@ -43,7 +73,7 @@
{
if
([
item
isKindOfClass
:[
NSDictionary
class
]])
return
YES
;
else
if
([
item
isKindOfClass
:[
AuXAccount
class
]])
else
if
([
item
isKindOfClass
:[
NSNumber
class
]])
return
YES
;
else
return
NO
;
...
...
@@ -62,8 +92,8 @@
{
if
([
item
isKindOfClass
:[
NSDictionary
class
]])
return
[[[
item
allObjects
]
objectAtIndex
:
0
]
count
];
else
if
([
item
isKindOfClass
:[
AuXAccount
class
]])
return
([
item
site
]
->
siteCode
()
==
SITE_ETSY
?
4
:
6
);
else
if
([
item
isKindOfClass
:[
NSNumber
class
]])
return
([
self
accountForItem
:
item
].
site
->
siteCode
()
==
SITE_ETSY
?
4
:
6
);
else
return
0
;
}
...
...
@@ -83,16 +113,30 @@
switch
(
index
)
{
case
0
:
// eBay
return
[[
NSDictionary
dictionaryWithObject
:[[
AuXAccountManager
sharedAccountManager
]
accountsForSite
:
SITE_EBAY
]
forKey
:
@"eBay"
]
retain
];
{
AccountVector
raw
=
AuAccountManager
::
accounts
();
NSMutableArray
*
eBays
=
[
NSMutableArray
arrayWithCapacity
:
raw
.
size
()];
for
(
unsigned
int
next
=
0
;
next
<
raw
.
size
();
next
++
)
if
(
raw
.
at
(
next
).
site
->
siteCode
()
==
SITE_EBAY
)
[
eBays
addObject
:[
NSNumber
numberWithInt
:
next
]];
return
[[
NSDictionary
dictionaryWithObject
:
eBays
forKey
:
@"eBay"
]
retain
];
}
case
1
:
// Etsy
return
[[
NSDictionary
dictionaryWithObject
:[[
AuXAccountManager
sharedAccountManager
]
accountsForSite
:
SITE_ETSY
]
forKey
:
@"Etsy"
]
retain
];
{
AccountVector
raw
=
AuAccountManager
::
accounts
();
NSMutableArray
*
Etsys
=
[
NSMutableArray
arrayWithCapacity
:
raw
.
size
()];
for
(
unsigned
int
next
=
0
;
next
<
raw
.
size
();
next
++
)
if
(
raw
.
at
(
next
).
site
->
siteCode
()
==
SITE_ETSY
)
[
Etsys
addObject
:[
NSNumber
numberWithInt
:
next
]];
return
[[
NSDictionary
dictionaryWithObject
:
Etsys
forKey
:
@"Etsy"
]
retain
];
}
}
}
else
{
if
([
item
isKindOfClass
:[
NSDictionary
class
]])
return
[[[
item
allObjects
]
objectAtIndex
:
0
]
objectAtIndex
:
index
];
else
if
([
item
isKindOfClass
:[
AuXAccount
class
]])
else
if
([
item
isKindOfClass
:[
NSNumber
class
]])
{
if
([
item
site
]
->
siteCode
()
==
SITE_ETSY
&&
index
>
0
)
index
++
;
if
([
self
accountForItem
:
item
].
site
->
siteCode
()
==
SITE_ETSY
&&
index
>
0
)
index
++
;
switch
(
index
)
{
case
0
:
return
@"Listed"
;
...
...
@@ -122,8 +166,8 @@
{
if
([
item
isKindOfClass
:[
NSDictionary
class
]])
return
[[
item
allKeys
]
objectAtIndex
:
0
];
else
if
([
item
isKindOfClass
:[
AuXAccount
class
]])
return
[
item
friendly
];
else
if
([
item
isKindOfClass
:[
NSNumber
class
]])
return
[
NSString
stringWithUTF8String
:[
self
accountForItem
:
item
].
friendly
];
else
return
item
;
}
...
...
@@ -138,8 +182,8 @@
if
([
selection
isKindOfClass
:[
NSDictionary
class
]])
{
NSLog
(
@"Site selected"
);
}
else
if
([
selection
isKindOfClass
:[
AuXAccount
class
]])
{
[
dashboard
setAccount
:
selection
];
}
else
if
([
selection
isKindOfClass
:[
NSNumber
class
]])
{
[
dashboard
setAccount
:
[
self
accountForItem
:
selection
]
];
}
else
NSLog
(
@"Detail selected"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment