libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / preferences / repositories / RepoRow.cpp
blob328f64c97579acebd1c9a5eddd541c7d33225bf6
1 /*
2 * Copyright 2017 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Brian Hill
7 */
10 #include "RepoRow.h"
12 #include <ColumnTypes.h>
14 #include "constants.h"
17 RepoRow::RepoRow(const char* repo_name, const char* repo_url, bool enabled)
19 BRow(),
20 fName(repo_name),
21 fUrl(repo_url),
22 fEnabled(enabled),
23 fTaskState(STATE_NOT_IN_QUEUE)
25 SetField(new BStringField(""), kEnabledColumn);
26 SetField(new BStringField(fName.String()), kNameColumn);
27 SetField(new BStringField(fUrl.String()), kUrlColumn);
28 if (enabled)
29 SetEnabled(enabled);
33 void
34 RepoRow::SetName(const char* name)
36 BStringField* field = (BStringField*)GetField(kNameColumn);
37 field->SetString(name);
38 fName.SetTo(name);
39 Invalidate();
43 void
44 RepoRow::SetEnabled(bool enabled)
46 fEnabled = enabled;
47 RefreshEnabledField();
51 void
52 RepoRow::RefreshEnabledField()
54 BStringField* field = (BStringField*)GetField(kEnabledColumn);
55 if (fTaskState == STATE_NOT_IN_QUEUE)
56 field->SetString(fEnabled ? B_TRANSLATE("Enabled") : "");
57 else
58 field->SetString(B_UTF8_ELLIPSIS);
59 Invalidate();
63 void
64 RepoRow::SetTaskState(uint32 state)
66 fTaskState = state;
67 RefreshEnabledField();