sbStatusPropertyBuilder.cpp
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2009 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
26 #include "sbStatusPropertyInfo.h"
27 
28 #include <nsAutoPtr.h>
29 
30 #include <sbIPropertyArray.h>
31 #include <sbIPropertyManager.h>
32 #include <nsIStringBundle.h>
33 
38 
39 NS_IMETHODIMP
41 {
42  NS_ENSURE_ARG_POINTER(_retval);
43  NS_ENSURE_STATE(!mPropertyID.IsEmpty());
44 
45  nsString displayName;
46  nsresult rv = GetFinalDisplayName(displayName);
47  NS_ENSURE_SUCCESS(rv, rv);
48 
49  nsString label;
50  if (!mLabelKey.IsEmpty()) {
51  rv = GetStringFromName(mBundle, mLabelKey, label);
52  NS_ENSURE_SUCCESS(rv, rv);
53  }
54  else {
55  label = mLabel;
56  }
57 
58  nsString completedLabel;
59  if (!mCompletedLabelKey.IsEmpty()) {
60  rv = GetStringFromName(mBundle, mCompletedLabelKey, completedLabel);
61  NS_ENSURE_SUCCESS(rv, rv);
62  }
63  else {
64  completedLabel = mCompletedLabel;
65  }
66 
67  nsString failedLabel;
68  if (!mFailedLabelKey.IsEmpty()) {
69  rv = GetStringFromName(mBundle, mFailedLabelKey, failedLabel);
70  NS_ENSURE_SUCCESS(rv, rv);
71  }
72  else {
73  failedLabel = mFailedLabel;
74  }
75 
76  nsRefPtr<sbStatusPropertyInfo> pi =
77  new sbStatusPropertyInfo(mPropertyID,
78  displayName,
79  mDisplayNameKey,
80  label,
81  completedLabel,
82  failedLabel,
83  mRemoteReadable,
84  mRemoteWritable,
85  mUserViewable,
86  mUserEditable);
87  NS_ENSURE_TRUE(pi, NS_ERROR_OUT_OF_MEMORY);
88 
89  rv = pi->Init();
90  NS_ENSURE_SUCCESS(rv, rv);
91 
92  NS_ADDREF(*_retval = pi);
93  return NS_OK;
94 }
95 
96 NS_IMETHODIMP
97 sbStatusPropertyBuilder::GetLabel(nsAString& aLabel)
98 {
99  aLabel = mLabel;
100  return NS_OK;
101 }
102 NS_IMETHODIMP
103 sbStatusPropertyBuilder::SetLabel(const nsAString& aLabel)
104 {
105  mLabel = aLabel;
106  return NS_OK;
107 }
108 
109 NS_IMETHODIMP
110 sbStatusPropertyBuilder::GetCompletedLabel(nsAString& aCompletedLabel)
111 {
112  aCompletedLabel = mCompletedLabel;
113  return NS_OK;
114 }
115 NS_IMETHODIMP
116 sbStatusPropertyBuilder::SetCompletedLabel(const nsAString& aCompletedLabel)
117 {
118  mCompletedLabel = aCompletedLabel;
119  return NS_OK;
120 }
121 
122 NS_IMETHODIMP
123 sbStatusPropertyBuilder::GetFailedLabel(nsAString& aFailedLabel)
124 {
125  aFailedLabel = mFailedLabel;
126  return NS_OK;
127 }
128 NS_IMETHODIMP
129 sbStatusPropertyBuilder::SetFailedLabel(const nsAString& aFailedLabel)
130 {
131  mFailedLabel = aFailedLabel;
132  return NS_OK;
133 }
134 
135 NS_IMETHODIMP
136 sbStatusPropertyBuilder::GetLabelKey(nsAString& aLabelKey)
137 {
138  aLabelKey = mLabelKey;
139  return NS_OK;
140 }
141 NS_IMETHODIMP
142 sbStatusPropertyBuilder::SetLabelKey(const nsAString& aLabelKey)
143 {
144  mLabelKey = aLabelKey;
145  return NS_OK;
146 }
147 
148 NS_IMETHODIMP
149 sbStatusPropertyBuilder::GetCompletedLabelKey(nsAString& aCompletedLabelKey)
150 {
151  aCompletedLabelKey = mCompletedLabelKey;
152  return NS_OK;
153 }
154 NS_IMETHODIMP
155 sbStatusPropertyBuilder::SetCompletedLabelKey(const nsAString& aCompletedLabelKey)
156 {
157  mCompletedLabelKey = aCompletedLabelKey;
158  return NS_OK;
159 }
160 
161 NS_IMETHODIMP
162 sbStatusPropertyBuilder::GetFailedLabelKey(nsAString& aFailedLabelKey)
163 {
164  aFailedLabelKey = mFailedLabelKey;
165  return NS_OK;
166 }
167 NS_IMETHODIMP
168 sbStatusPropertyBuilder::SetFailedLabelKey(const nsAString& aFailedLabelKey)
169 {
170  mFailedLabelKey = aFailedLabelKey;
171  return NS_OK;
172 }
return NS_OK
this _contentSandbox label
Definition: FeedWriter.js:814
An interface used to describe a metadata property for use by the UI and other sbILibrary interfaces (...
NS_IMPL_ISUPPORTS_INHERITED2(sbStatusPropertyBuilder, sbAbstractPropertyBuilder, sbISimpleButtonPropertyBuilder, sbIStatusPropertyBuilder) NS_IMETHODIMP sbStatusPropertyBuilder